mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
(glcore/slang) Set filter and wrap mode correctly when intialising shader textures
This commit is contained in:
parent
9c100ded3a
commit
548c5dc925
@ -431,7 +431,7 @@ public:
|
||||
unsigned width, unsigned height,
|
||||
bool linear,
|
||||
bool mipmap,
|
||||
GLenum address);
|
||||
gl_core_filter_chain_address address);
|
||||
~StaticTexture();
|
||||
|
||||
StaticTexture(StaticTexture&&) = delete;
|
||||
@ -449,17 +449,27 @@ private:
|
||||
|
||||
StaticTexture::StaticTexture(string id_, GLuint image_,
|
||||
unsigned width, unsigned height, bool linear, bool mipmap,
|
||||
GLenum address)
|
||||
gl_core_filter_chain_address address)
|
||||
: id(std::move(id_)), image(image_)
|
||||
{
|
||||
texture.texture.width = width;
|
||||
GLenum gl_address = address_to_gl(address);
|
||||
|
||||
texture.filter = GL_CORE_FILTER_CHAIN_NEAREST;
|
||||
texture.mip_filter = GL_CORE_FILTER_CHAIN_NEAREST;
|
||||
texture.address = address;
|
||||
texture.texture.width = width;
|
||||
texture.texture.height = height;
|
||||
texture.texture.format = 0;
|
||||
texture.texture.image = image;
|
||||
texture.texture.image = image;
|
||||
|
||||
if (linear)
|
||||
texture.filter = GL_CORE_FILTER_CHAIN_LINEAR;
|
||||
if (mipmap && linear)
|
||||
texture.mip_filter = GL_CORE_FILTER_CHAIN_LINEAR;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, image);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, address);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, address);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, gl_address);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gl_address);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, linear ? GL_LINEAR : GL_NEAREST);
|
||||
if (linear && mipmap)
|
||||
@ -2126,7 +2136,7 @@ static unique_ptr<gl_core_shader::StaticTexture> gl_core_filter_chain_load_lut(
|
||||
tex, image.width, image.height,
|
||||
shader->filter != RARCH_FILTER_NEAREST,
|
||||
levels > 1,
|
||||
gl_core_shader::address_to_gl(gl_core_shader::wrap_to_address(shader->wrap))));
|
||||
gl_core_shader::wrap_to_address(shader->wrap)));
|
||||
}
|
||||
|
||||
static bool gl_core_filter_chain_load_luts(
|
||||
|
@ -90,8 +90,13 @@ bool image_texture_color_convert(unsigned r_shift,
|
||||
uint8_t r = (uint8_t)(col >> 16);
|
||||
uint8_t g = (uint8_t)(col >> 8);
|
||||
uint8_t b = (uint8_t)(col >> 0);
|
||||
pixels[i] = (a << a_shift) |
|
||||
(r << r_shift) | (g << g_shift) | (b << b_shift);
|
||||
/* Explicitly cast these to uint32_t to prevent
|
||||
* ASAN runtime error: left shift of 255 by 24 places
|
||||
* cannot be represented in type 'int' */
|
||||
pixels[i] = ((uint32_t)a << a_shift) |
|
||||
((uint32_t)r << r_shift) |
|
||||
((uint32_t)g << g_shift) |
|
||||
((uint32_t)b << b_shift);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user