[PATCH 1/2] wined3d: Use the np2_fixup to find out if a RECT texture is used
Stefan Dösinger
stefan at codeweavers.com
Thu Apr 11 04:32:54 CDT 2013
---
dlls/wined3d/arb_program_shader.c | 10 ++--------
dlls/wined3d/glsl_shader.c | 8 ++++----
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 7e695fd..f540332 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -1368,11 +1368,8 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
{
struct wined3d_shader_buffer *buffer = ins->ctx->buffer;
DWORD sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx];
- const struct wined3d_shader *shader = ins->ctx->shader;
- const struct wined3d_texture *texture;
const char *tex_type;
BOOL np2_fixup = FALSE;
- struct wined3d_device *device = shader->device;
struct shader_arb_ctx_priv *priv = ins->ctx->backend_data;
const char *mod;
BOOL pshader = shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type);
@@ -1386,13 +1383,10 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
break;
case WINED3DSTT_2D:
- texture = device->stateBlock->state.textures[sampler_idx];
- if (texture && texture->target == GL_TEXTURE_RECTANGLE_ARB)
- {
+ if (pshader && priv->cur_ps_args->super.np2_fixup & (1 << sampler_idx))
tex_type = "RECT";
- } else {
+ else
tex_type = "2D";
- }
if (shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type))
{
if (priv->cur_np2fixup_info->super.active & (1 << sampler_idx))
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index a840a5d..a56f579 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1058,7 +1058,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
if (reg_maps->sampler_type[i])
{
BOOL shadow_sampler = version->type == WINED3D_SHADER_TYPE_PIXEL && (ps_args->shadow & (1 << i));
- const struct wined3d_texture *texture;
+ BOOL tex_rect;
switch (reg_maps->sampler_type[i])
{
@@ -1069,17 +1069,17 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
shader_addline(buffer, "uniform sampler1D %s_sampler%u;\n", prefix, i);
break;
case WINED3DSTT_2D:
- texture = state->textures[i];
+ tex_rect = version->type == WINED3D_SHADER_TYPE_PIXEL && (ps_args->np2_fixup & (1 << i));
if (shadow_sampler)
{
- if (texture && texture->target == GL_TEXTURE_RECTANGLE_ARB)
+ if (tex_rect)
shader_addline(buffer, "uniform sampler2DRectShadow %s_sampler%u;\n", prefix, i);
else
shader_addline(buffer, "uniform sampler2DShadow %s_sampler%u;\n", prefix, i);
}
else
{
- if (texture && texture->target == GL_TEXTURE_RECTANGLE_ARB)
+ if (tex_rect)
shader_addline(buffer, "uniform sampler2DRect %s_sampler%u;\n", prefix, i);
else
shader_addline(buffer, "uniform sampler2D %s_sampler%u;\n", prefix, i);
--
1.8.1.5
More information about the wine-patches
mailing list