From 2db00e33515558a86224ff7c1561ae5c27452a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sat, 12 Jul 2014 16:41:51 -0700 Subject: [PATCH] DX9: Fixed texture lod. --- examples/common/imgui/fs_imgui_image.bin.h | 4 ++-- examples/common/imgui/fs_imgui_image.sc | 5 ++--- src/bgfx_shader.sh | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/common/imgui/fs_imgui_image.bin.h b/examples/common/imgui/fs_imgui_image.bin.h index 2425f6cf2..65b4e9c48 100644 --- a/examples/common/imgui/fs_imgui_image.bin.h +++ b/examples/common/imgui/fs_imgui_image.bin.h @@ -40,8 +40,8 @@ static const uint8_t fs_imgui_image_dx9[342] = 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........?....... 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, // ................ 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x05, 0x00, 0x00, // ................ - 0x03, 0x00, 0x00, 0x0b, 0x80, 0x01, 0x00, 0x60, 0xa0, 0x00, 0x00, 0x24, 0x90, 0x01, 0x00, 0x00, // .......`...$.... - 0x02, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ........._...... + 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0xc4, 0x90, 0x01, 0x00, 0x00, // ................ + 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ........._...... 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, // ................ 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x08, 0x80, 0x01, 0x00, 0x00, // ................ 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ...... diff --git a/examples/common/imgui/fs_imgui_image.sc b/examples/common/imgui/fs_imgui_image.sc index 5364eeea6..281a85d9d 100644 --- a/examples/common/imgui/fs_imgui_image.sc +++ b/examples/common/imgui/fs_imgui_image.sc @@ -12,7 +12,6 @@ SAMPLER2D(u_texColor, 0); void main() { - vec4 color = texture2DLod(u_texColor, v_texcoord0, u_imageLod); - - gl_FragColor = vec4(color.xyz, 1.0); + vec4 color = texture2DLod(u_texColor, v_texcoord0, u_imageLod); + gl_FragColor = vec4(color.xyz, 1.0); } diff --git a/src/bgfx_shader.sh b/src/bgfx_shader.sh index ee93ebfd6..ed6c44fdf 100644 --- a/src/bgfx_shader.sh +++ b/src/bgfx_shader.sh @@ -172,7 +172,7 @@ float bgfxShadow2DProj(sampler2DShadow _sampler, vec4 _coord) # define SAMPLER2D(_name, _reg) uniform sampler2D _name : register(s ## _reg) # define texture2D(_sampler, _coord) tex2D(_sampler, _coord) -# define texture2DLod(_sampler, _coord, _level) tex2Dlod(_sampler, vec4( (_coord).xy, _level, 0.0) ) +# define texture2DLod(_sampler, _coord, _level) tex2Dlod(_sampler, vec4( (_coord).xy, 0.0, _level) ) # define texture2DProj(_sampler, _coord) bgfxTexture2DProj(_sampler, _coord) # define SAMPLER2DSHADOW(_name, _reg) uniform sampler2DShadow _name : register(s ## _reg)