From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/context_gl.c | 2 - dlls/wined3d/glsl_shader.c | 201 ++------------------------------- dlls/wined3d/resource.c | 18 +-- dlls/wined3d/shader.c | 5 - dlls/wined3d/texture.c | 8 +- dlls/wined3d/utils.c | 14 --- dlls/wined3d/view.c | 4 - dlls/wined3d/wined3d_private.h | 31 +---- 8 files changed, 11 insertions(+), 272 deletions(-)
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index 95225a06172..983f6726734 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -4303,8 +4303,6 @@ static BOOL context_apply_draw_state(struct wined3d_context *context,
wined3d_context_gl_check_fbo_status(context_gl, GL_FRAMEBUFFER);
- /* WINED3D_SHADER_CONST_PS_NP2_FIXUP may be set when binding shader - * resources, so constant loading needs to be done after that. */ device->shader_backend->shader_apply_draw_state(device->shader_priv, context, state); context->shader_update_mask &= 1u << WINED3D_SHADER_TYPE_COMPUTE; context->constant_update_mask = 0; diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index f3ac9e1095c..c7c1a7605fe 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -227,9 +227,7 @@ struct glsl_ps_program GLint fog_end_location; GLint fog_scale_location; GLint alpha_test_ref_location; - GLint np2_fixup_location; GLint color_key_location; - const struct ps_np2fixup_info *np2_fixup_info; };
struct glsl_cs_program @@ -272,7 +270,6 @@ struct shader_glsl_ctx_priv const struct vs_compile_args *cur_vs_args; const struct ds_compile_args *cur_ds_args; const struct ps_compile_args *cur_ps_args; - struct ps_np2fixup_info *cur_np2fixup_info; struct wined3d_string_buffer_list *string_buffers; };
@@ -286,7 +283,6 @@ struct glsl_context_data struct glsl_ps_compiled_shader { struct ps_compile_args args; - struct ps_np2fixup_info np2fixup; GLuint id; };
@@ -1481,31 +1477,6 @@ static void reset_program_constant_version(struct wine_rb_entry *entry, void *co WINE_RB_ENTRY_VALUE(entry, struct glsl_shader_prog_link, program_lookup_entry)->constant_version = 0; }
-/* Context activation is done by the caller (state handler). */ -static void shader_glsl_load_np2fixup_constants(const struct glsl_ps_program *ps, - const struct wined3d_gl_info *gl_info, const struct wined3d_state *state) -{ - struct - { - float sx, sy; - } - np2fixup_constants[WINED3D_MAX_FRAGMENT_SAMPLERS]; - UINT fixup = ps->np2_fixup_info->active; - UINT i; - - for (i = 0; fixup; fixup >>= 1, ++i) - { - unsigned char idx = ps->np2_fixup_info->idx[i]; - const struct wined3d_texture *tex; - - tex = texture_from_resource(state->shader_resource_view[WINED3D_SHADER_TYPE_PIXEL][i]->resource); - np2fixup_constants[idx].sx = tex->pow2_matrix[0]; - np2fixup_constants[idx].sy = tex->pow2_matrix[5]; - } - - GL_EXTCALL(glUniform4fv(ps->np2_fixup_location, ps->np2_fixup_info->num_consts, &np2fixup_constants[0].sx)); -} - static void transpose_matrix(struct wined3d_matrix *out, const struct wined3d_matrix *m) { struct wined3d_matrix temp; @@ -1917,8 +1888,6 @@ static void shader_glsl_load_constants(struct shader_glsl_priv *priv, checkGLcall("bump env uniforms"); }
- if (update_mask & WINED3D_SHADER_CONST_PS_NP2_FIXUP) - shader_glsl_load_np2fixup_constants(&prog->ps, gl_info, state); if (update_mask & WINED3D_SHADER_CONST_FFP_COLOR_KEY) shader_glsl_load_color_key_constant(&prog->ps, gl_info, state);
@@ -2466,7 +2435,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c { struct wined3d_shader_sampler_map_entry *entry; const char *sampler_type_prefix, *sampler_type; - BOOL shadow_sampler, tex_rect; + BOOL shadow_sampler;
entry = ®_maps->sampler_map.entries[i];
@@ -2517,23 +2486,10 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c break;
case WINED3D_SHADER_RESOURCE_TEXTURE_2D: - tex_rect = version->type == WINED3D_SHADER_TYPE_PIXEL - && (ps_args->np2_fixup & (1u << entry->resource_idx)) - && gl_info->supported[ARB_TEXTURE_RECTANGLE]; if (shadow_sampler) - { - if (tex_rect) - sampler_type = "sampler2DRectShadow"; - else - sampler_type = "sampler2DShadow"; - } + sampler_type = "sampler2DShadow"; else - { - if (tex_rect) - sampler_type = "sampler2DRect"; - else - sampler_type = "sampler2D"; - } + sampler_type = "sampler2D"; break;
case WINED3D_SHADER_RESOURCE_TEXTURE_3D: @@ -3585,9 +3541,6 @@ static void shader_glsl_get_sample_function(const struct wined3d_shader_context const struct wined3d_gl_info *gl_info = priv->gl_info; BOOL shadow = shader_sampler_is_shadow(ctx->shader, priv->cur_ps_args, resource_idx, sampler_idx); BOOL projected = flags & WINED3D_GLSL_SAMPLE_PROJECTED; - BOOL texrect = ctx->reg_maps->shader_version.type == WINED3D_SHADER_TYPE_PIXEL - && priv->cur_ps_args->np2_fixup & (1u << resource_idx) - && gl_info->supported[ARB_TEXTURE_RECTANGLE]; BOOL lod = flags & WINED3D_GLSL_SAMPLE_LOD; BOOL grad = flags & WINED3D_GLSL_SAMPLE_GRAD; BOOL offset = flags & WINED3D_GLSL_SAMPLE_OFFSET; @@ -3616,8 +3569,6 @@ static void shader_glsl_get_sample_function(const struct wined3d_shader_context base = "shadow";
type_part = resource_type_info[resource_type].type_part; - if (resource_type == WINED3D_SHADER_RESOURCE_TEXTURE_2D && texrect) - type_part = "2DRect"; if (!type_part[0] && resource_type != WINED3D_SHADER_RESOURCE_TEXTURE_CUBEARRAY) FIXME("Unhandled resource type %#x.\n", resource_type);
@@ -3776,7 +3727,6 @@ static void PRINTF_ATTR(9, 10) shader_glsl_gen_sample_code(const struct wined3d_ const struct wined3d_shader_version *version = &ins->ctx->reg_maps->shader_version; char dst_swizzle[6]; struct color_fixup_desc fixup; - BOOL np2_fixup = FALSE; va_list args; int ret;
@@ -3788,9 +3738,6 @@ static void PRINTF_ATTR(9, 10) shader_glsl_gen_sample_code(const struct wined3d_ { const struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data; fixup = priv->cur_ps_args->color_fixup[sampler_bind_idx]; - - if (priv->cur_ps_args->np2_fixup & (1u << sampler_bind_idx)) - np2_fixup = TRUE; } else { @@ -3816,31 +3763,6 @@ static void PRINTF_ATTR(9, 10) shader_glsl_gen_sample_code(const struct wined3d_ break; }
- if (np2_fixup) - { - const struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data; - const unsigned char idx = priv->cur_np2fixup_info->idx[sampler_bind_idx]; - - switch (shader_glsl_get_write_mask_size(sample_function->coord_mask)) - { - case 1: - shader_addline(ins->ctx->buffer, " * ps_samplerNP2Fixup[%u].%s", - idx >> 1, (idx % 2) ? "z" : "x"); - break; - case 2: - shader_addline(ins->ctx->buffer, " * ps_samplerNP2Fixup[%u].%s", - idx >> 1, (idx % 2) ? "zw" : "xy"); - break; - case 3: - shader_addline(ins->ctx->buffer, " * vec3(ps_samplerNP2Fixup[%u].%s, 1.0)", - idx >> 1, (idx % 2) ? "zw" : "xy"); - break; - case 4: - shader_addline(ins->ctx->buffer, " * vec4(ps_samplerNP2Fixup[%u].%s, 1.0, 1.0)", - idx >> 1, (idx % 2) ? "zw" : "xy"); - break; - } - } if (dx && dy) shader_addline(ins->ctx->buffer, ", %s, %s", dx, dy); else if (bias) @@ -7841,8 +7763,7 @@ static void shader_glsl_generate_ps_epilogue(const struct wined3d_gl_info *gl_in
/* Context activation is done by the caller. */ static GLuint shader_glsl_generate_fragment_shader(const struct wined3d_context_gl *context_gl, - struct shader_glsl_priv *priv, const struct wined3d_shader *shader, - const struct ps_compile_args *args, struct ps_np2fixup_info *np2fixup_info) + struct shader_glsl_priv *priv, const struct wined3d_shader *shader, const struct ps_compile_args *args) { const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; struct wined3d_string_buffer_list *string_buffers = &priv->string_buffers; @@ -7862,7 +7783,6 @@ static GLuint shader_glsl_generate_fragment_shader(const struct wined3d_context_ memset(&priv_ctx, 0, sizeof(priv_ctx)); priv_ctx.gl_info = gl_info; priv_ctx.cur_ps_args = args; - priv_ctx.cur_np2fixup_info = np2fixup_info; priv_ctx.string_buffers = string_buffers;
shader_glsl_add_version_declaration(buffer, gl_info); @@ -7898,44 +7818,6 @@ static GLuint shader_glsl_generate_fragment_shader(const struct wined3d_context_ shader_addline(buffer, "layout (depth_less) out float gl_FragDepth;\n"); }
- /* Declare uniforms for NP2 texcoord fixup: - * This is NOT done inside the loop that declares the texture samplers - * since the NP2 fixup code is currently only used for the GeforceFX - * series and when forcing the ARB_npot extension off. Modern cards just - * skip the code anyway, so put it inside a separate loop. */ - if (args->np2_fixup) - { - struct ps_np2fixup_info *fixup = priv_ctx.cur_np2fixup_info; - unsigned int cur = 0; - - /* NP2/RECT textures in OpenGL use texcoords in the range [0,width]x[0,height] - * while D3D has them in the (normalized) [0,1]x[0,1] range. - * samplerNP2Fixup stores texture dimensions and is updated through - * shader_glsl_load_np2fixup_constants when the sampler changes. */ - - for (i = 0; i < shader->limits->sampler; ++i) - { - enum wined3d_shader_resource_type resource_type; - - resource_type = pixelshader_get_resource_type(reg_maps, i, args->tex_types); - - if (!resource_type || !(args->np2_fixup & (1u << i))) - continue; - - if (resource_type != WINED3D_SHADER_RESOURCE_TEXTURE_2D) - { - FIXME("Non-2D texture is flagged for NP2 texcoord fixup.\n"); - continue; - } - - fixup->idx[i] = cur++; - } - - fixup->num_consts = (cur + 1) >> 1; - fixup->active = args->np2_fixup; - shader_addline(buffer, "uniform vec4 %s_samplerNP2Fixup[%u];\n", prefix, fixup->num_consts); - } - if (version->major < 3 || args->vp_mode != WINED3D_VP_MODE_SHADER) { shader_addline(buffer, "uniform struct\n{\n"); @@ -8719,12 +8601,10 @@ static GLuint shader_glsl_generate_compute_shader(const struct wined3d_context_g }
static GLuint find_glsl_fragment_shader(const struct wined3d_context_gl *context_gl, - struct shader_glsl_priv *priv, struct wined3d_shader *shader, - const struct ps_compile_args *args, const struct ps_np2fixup_info **np2fixup_info) + struct shader_glsl_priv *priv, struct wined3d_shader *shader, const struct ps_compile_args *args) { struct glsl_ps_compiled_shader *gl_shaders, *new_array; struct glsl_shader_private *shader_data; - struct ps_np2fixup_info *np2fixup; UINT i; DWORD new_size; GLuint ret; @@ -8747,11 +8627,7 @@ static GLuint find_glsl_fragment_shader(const struct wined3d_context_gl *context for (i = 0; i < shader_data->num_gl_shaders; ++i) { if (!memcmp(&gl_shaders[i].args, args, sizeof(*args))) - { - if (args->np2_fixup) - *np2fixup_info = &gl_shaders[i].np2fixup; return gl_shaders[i].id; - } }
TRACE("No matching GL shader found for shader %p, compiling a new shader.\n", shader); @@ -8779,12 +8655,8 @@ static GLuint find_glsl_fragment_shader(const struct wined3d_context_gl *context
gl_shaders[shader_data->num_gl_shaders].args = *args;
- np2fixup = &gl_shaders[shader_data->num_gl_shaders].np2fixup; - memset(np2fixup, 0, sizeof(*np2fixup)); - *np2fixup_info = args->np2_fixup ? np2fixup : NULL; - string_buffer_clear(&priv->shader_buffer); - ret = shader_glsl_generate_fragment_shader(context_gl, priv, shader, args, np2fixup); + ret = shader_glsl_generate_fragment_shader(context_gl, priv, shader, args); gl_shaders[shader_data->num_gl_shaders++].id = ret;
return ret; @@ -10305,7 +10177,6 @@ static void shader_glsl_init_ps_uniform_locations(const struct wined3d_gl_info *
ps->alpha_test_ref_location = GL_EXTCALL(glGetUniformLocation(program_id, "alpha_test_ref"));
- ps->np2_fixup_location = GL_EXTCALL(glGetUniformLocation(program_id, "ps_samplerNP2Fixup")); ps->color_key_location = GL_EXTCALL(glGetUniformLocation(program_id, "color_key"));
string_buffer_release(&priv->string_buffers, name); @@ -10365,7 +10236,6 @@ static HRESULT shader_glsl_compile_compute_shader(struct shader_glsl_priv *priv, entry->cs.id = shader_id; entry->constant_version = 0; entry->shader_controlled_clip_distances = 0; - entry->ps.np2_fixup_info = NULL; add_glsl_program_entry(priv, entry);
TRACE("Attaching GLSL shader object %u to program %u.\n", shader_id, program_id); @@ -10442,7 +10312,6 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl, const struct wined3d_d3d_info *d3d_info = context_gl->c.d3d_info; const struct wined3d_gl_info *gl_info = context_gl->gl_info; const struct wined3d_shader *pre_rasterization_shader; - const struct ps_np2fixup_info *np2fixup_info = NULL; struct wined3d_shader *hshader, *dshader, *gshader; struct glsl_shader_prog_link *entry = NULL; struct wined3d_shader *vshader = NULL; @@ -10541,7 +10410,7 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl, pshader = state->shader[WINED3D_SHADER_TYPE_PIXEL]; find_ps_compile_args(state, pshader, context_gl->c.stream_info.position_transformed, &ps_compile_args, &context_gl->c); - ps_id = find_glsl_fragment_shader(context_gl, priv, pshader, &ps_compile_args, &np2fixup_info); + ps_id = find_glsl_fragment_shader(context_gl, priv, pshader, &ps_compile_args); ps_list = &pshader->linked_programs; } else if (priv->fragment_pipe == &glsl_fragment_pipe @@ -10583,7 +10452,6 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl, entry->cs.id = 0; entry->constant_version = 0; entry->shader_controlled_clip_distances = 0; - entry->ps.np2_fixup_info = np2fixup_info; /* Add the hash table entry */ add_glsl_program_entry(priv, entry);
@@ -10849,8 +10717,6 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl, entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_FOG; if (entry->ps.alpha_test_ref_location != -1) entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_ALPHA_TEST; - if (entry->ps.np2_fixup_location != -1) - entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_NP2_FIXUP; if (entry->ps.color_key_location != -1) entry->constant_update_mask |= WINED3D_SHADER_CONST_FFP_COLOR_KEY; } @@ -12089,31 +11955,6 @@ static void glsl_vertex_pipe_texmatrix(struct wined3d_context *context, context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_TEXMATRIX; }
-static void glsl_vertex_pipe_texmatrix_np2(struct wined3d_context *context, - const struct wined3d_state *state, DWORD state_id) -{ - DWORD sampler = state_id - STATE_SAMPLER(0); - const struct wined3d_texture *texture = wined3d_state_get_ffp_texture(state, sampler); - BOOL np2; - - if (!texture) - return; - - if (sampler >= WINED3D_MAX_FFP_TEXTURES) - return; - - if ((np2 = !(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT)) - || context->lastWasPow2Texture & (1u << sampler)) - { - if (np2) - context->lastWasPow2Texture |= 1u << sampler; - else - context->lastWasPow2Texture &= ~(1u << sampler); - - context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_TEXMATRIX; - } -} - static void glsl_vertex_pipe_material(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -12264,34 +12105,6 @@ static const struct wined3d_state_entry_template glsl_vertex_pipe_vp_states[] = {STATE_RENDER(WINED3D_RS_POINTSCALE_B), {STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_POINTSCALE_C), {STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_POINTSIZE_MAX), {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), NULL }, WINED3D_GL_EXT_NONE }, - /* NP2 texture matrix fixups. They are not needed if - * GL_ARB_texture_non_power_of_two is supported. Otherwise, register - * glsl_vertex_pipe_texmatrix(), which takes care of updating the texture - * matrix. */ - {STATE_SAMPLER(0), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(0), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, - {STATE_SAMPLER(0), {STATE_SAMPLER(0), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(1), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(1), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, - {STATE_SAMPLER(1), {STATE_SAMPLER(1), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(2), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(2), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, - {STATE_SAMPLER(2), {STATE_SAMPLER(2), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(3), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(3), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, - {STATE_SAMPLER(3), {STATE_SAMPLER(3), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(4), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(4), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, - {STATE_SAMPLER(4), {STATE_SAMPLER(4), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(5), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(5), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, - {STATE_SAMPLER(5), {STATE_SAMPLER(5), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(6), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(6), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, - {STATE_SAMPLER(6), {STATE_SAMPLER(6), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(7), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(7), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, - {STATE_SAMPLER(7), {STATE_SAMPLER(7), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, {STATE_POINT_ENABLE, {STATE_POINT_ENABLE, glsl_vertex_pipe_shader}, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_SHADEMODE), {STATE_RENDER(WINED3D_RS_SHADEMODE), glsl_vertex_pipe_shademode}, WINED3D_GLSL_130 }, {STATE_RENDER(WINED3D_RS_SHADEMODE), {STATE_RENDER(WINED3D_RS_SHADEMODE), glsl_vertex_pipe_nop }, WINED3D_GL_EXT_NONE }, diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index b0537ffd305..fcfe05db835 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -58,10 +58,8 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * unsigned int size, void *parent, const struct wined3d_parent_ops *parent_ops, const struct wined3d_resource_ops *resource_ops) { - const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; enum wined3d_gl_resource_type base_type = WINED3D_GL_RES_TYPE_COUNT; enum wined3d_gl_resource_type gl_type = WINED3D_GL_RES_TYPE_COUNT; - BOOL tex_2d_ok = FALSE; unsigned int i;
static const struct @@ -141,26 +139,12 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * WARN("Format %s cannot be used for texturing.\n", debug_d3dformat(format->id)); continue; } - if (((width & (width - 1)) || (height & (height - 1))) - && !d3d_info->texture_npot && !d3d_info->normalized_texrect - && gl_type == WINED3D_GL_RES_TYPE_TEX_2D) - { - TRACE("Skipping 2D texture type to try texture rectangle.\n"); - tex_2d_ok = TRUE; - continue; - } break; }
if (base_type != WINED3D_GL_RES_TYPE_COUNT && i == ARRAY_SIZE(resource_types)) { - if (tex_2d_ok) - { - /* Non power of 2 texture and rectangle textures or renderbuffers do not work. - * Use 2D textures, the texture code will pad to a power of 2 size. */ - gl_type = WINED3D_GL_RES_TYPE_TEX_2D; - } - else if (usage & WINED3DUSAGE_SCRATCH) + if (usage & WINED3DUSAGE_SCRATCH) { /* Needed for proper format information. */ gl_type = base_type; diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index e08e59125b1..09ecc51b608 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -2938,7 +2938,6 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 args->shadow = 0; for (i = 0 ; i < WINED3D_MAX_FRAGMENT_SAMPLERS; ++i) args->color_fixup[i] = COLOR_FIXUP_IDENTITY; - args->np2_fixup = 0; } else { @@ -2961,10 +2960,6 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
if (texture->resource.format_caps & WINED3D_FORMAT_CAP_SHADOW) args->shadow |= 1u << i; - - /* Flag samplers that need NP2 texcoord fixup. */ - if (!(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT)) - args->np2_fixup |= (1u << i); } }
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index bbf8a8bc249..c88f63aa222 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -3825,7 +3825,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc texture->layer_count = layer_count; texture->level_count = level_count; texture->lod = 0; - texture->flags |= WINED3D_TEXTURE_POW2_MAT_IDENT | WINED3D_TEXTURE_DOWNLOADABLE; + texture->flags |= WINED3D_TEXTURE_DOWNLOADABLE; if (flags & WINED3D_TEXTURE_CREATE_GET_DC_LENIENT) { texture->flags |= WINED3D_TEXTURE_GET_DC_LENIENT; @@ -3855,12 +3855,6 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc wined3d_texture_dirty_region_add(texture, i, NULL); }
- texture->pow2_matrix[0] = 1.0f; - texture->pow2_matrix[5] = 1.0f; - texture->pow2_matrix[10] = 1.0f; - texture->pow2_matrix[15] = 1.0f; - TRACE("x scale %.8e, y scale %.8e.\n", texture->pow2_matrix[0], texture->pow2_matrix[5]); - if (wined3d_texture_use_pbo(texture, d3d_info)) texture->resource.map_binding = WINED3D_LOCATION_BUFFER;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 25cb992d021..5e33066c8b8 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5822,7 +5822,6 @@ void get_texture_matrix(const struct wined3d_context *context, const struct wine != WINED3DTSS_TCI_PASSTHRU; unsigned int coord_idx = min(state->texture_states[tex][WINED3D_TSS_TEXCOORD_INDEX] & 0x0000ffff, WINED3D_MAX_FFP_TEXTURES - 1); - struct wined3d_texture *texture = wined3d_state_get_ffp_texture(state, tex);
compute_texture_matrix(&state->transforms[WINED3D_TS_TEXTURE0 + tex], state->texture_states[tex][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS], @@ -5831,19 +5830,6 @@ void get_texture_matrix(const struct wined3d_context *context, const struct wine ? context->stream_info.elements[WINED3D_FFP_TEXCOORD0 + coord_idx].format->id : WINED3DFMT_UNKNOWN, context->d3d_info->ffp_fragment_caps.proj_control, mat); - - if (texture && !(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT)) - { - if (generated) - FIXME("Non-power-of-two texture being used with generated texture coords.\n"); - /* NP2 texcoord fixup is implemented for pixelshaders so only enable the - * fixed-function-pipeline fixup via pow2Matrix when no PS is used. */ - if (!use_ps(state)) - { - TRACE("Non-power-of-two texture matrix multiply fixup.\n"); - multiply_matrix(mat, mat, (struct wined3d_matrix *)texture->pow2_matrix); - } - } }
void get_pointsize_minmax(const struct wined3d_context *context, const struct wined3d_state *state, diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c index 73fd6d1125c..4973dc3bca4 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c @@ -1305,10 +1305,6 @@ void wined3d_shader_resource_view_gl_bind(struct wined3d_shader_resource_view_gl texture_gl = wined3d_texture_gl(wined3d_texture_from_resource(view_gl->v.resource)); wined3d_texture_gl_bind(texture_gl, context_gl, sampler_gl->s.desc.srgb_decode); wined3d_sampler_gl_bind(sampler_gl, unit, texture_gl, context_gl); - - /* Trigger shader constant reloading (for NP2 texcoord fixup) */ - if (!(texture_gl->t.flags & WINED3D_TEXTURE_POW2_MAT_IDENT)) - context_gl->c.constant_update_mask |= WINED3D_SHADER_CONST_PS_NP2_FIXUP; }
/* Context activation is done by the caller. */ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 431ccff6316..cb97a2587ba 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -523,7 +523,6 @@ enum wined3d_shader_resource_type #define WINED3D_SHADER_CONST_PS_BUMP_ENV 0x00000200 #define WINED3D_SHADER_CONST_PS_FOG 0x00000400 #define WINED3D_SHADER_CONST_PS_ALPHA_TEST 0x00000800 -#define WINED3D_SHADER_CONST_PS_NP2_FIXUP 0x00002000 #define WINED3D_SHADER_CONST_FFP_MODELVIEW 0x00004000 #define WINED3D_SHADER_CONST_FFP_VERTEXBLEND 0x00008000 #define WINED3D_SHADER_CONST_FFP_PROJ 0x00010000 @@ -1469,8 +1468,7 @@ enum wined3d_ffp_ps_fog_mode #define WINED3D_PSARGS_TEXTYPE_SHIFT 2 #define WINED3D_PSARGS_TEXTYPE_MASK 0x3u
-/* Used for Shader Model 1 pixel shaders to track the bound texture - * type. 2D and RECT textures are separated through NP2 fixup. */ +/* Used for Shader Model 1 pixel shaders to track the bound texture type. */ enum wined3d_shader_tex_types { WINED3D_SHADER_TEX_2D = 0, @@ -1487,13 +1485,8 @@ struct ps_compile_args DWORD tex_types; /* ps 1 - 3, 16 textures */ WORD tex_transform; /* ps 1.0-1.3, 4 textures */ WORD srgb_correction; - /* Bitmap for NP2 texcoord fixups (16 samplers max currently). - D3D9 has a limit of 16 samplers and the fixup is superfluous - in D3D10 (unconditional NP2 support mandatory). */ - WORD np2_fixup; WORD shadow; /* WINED3D_MAX_FRAGMENT_SAMPLERS, 16 */ WORD texcoords_initialized; /* WINED3D_MAX_FFP_TEXTURES, 8 */ - WORD padding_to_dword; DWORD pointsprite : 1; DWORD flatshading : 1; DWORD alpha_test_func : 3; @@ -1943,7 +1936,6 @@ struct wined3d_context DWORD texShaderBumpMap : 8; /* WINED3D_MAX_FFP_TEXTURES, 8 */ DWORD lowest_disabled_stage : 4; /* Max WINED3D_MAX_FFP_TEXTURES, 8 */
- DWORD lastWasPow2Texture : 8; /* WINED3D_MAX_FFP_TEXTURES, 8 */ DWORD fixed_function_usage_map : 8; /* WINED3D_MAX_FFP_TEXTURES, 8 */ DWORD use_immediate_mode_draw : 1; DWORD uses_uavs : 1; @@ -1958,7 +1950,7 @@ struct wined3d_context DWORD update_primitive_type : 1; DWORD update_patch_vertex_count : 1; DWORD update_multisample_state : 1; - DWORD padding : 3; + DWORD padding : 11;
DWORD clip_distance_mask : 8; /* WINED3D_MAX_CLIP_DISTANCES, 8 */
@@ -3300,7 +3292,6 @@ struct wined3d_texture_ops };
#define WINED3D_TEXTURE_COND_NP2 0x00000001 -#define WINED3D_TEXTURE_POW2_MAT_IDENT 0x00000004 #define WINED3D_TEXTURE_IS_SRGB 0x00000008 #define WINED3D_TEXTURE_RGB_ALLOCATED 0x00000010 #define WINED3D_TEXTURE_RGB_VALID 0x00000020 @@ -3327,7 +3318,6 @@ struct wined3d_texture unsigned int level_count; unsigned int download_count; unsigned int sysmem_count; - float pow2_matrix[16]; unsigned int lod; uint32_t flags; DWORD update_map_binding; @@ -4417,23 +4407,6 @@ void get_pointsize(const struct wined3d_context *context, const struct wined3d_s void get_fog_start_end(const struct wined3d_context *context, const struct wined3d_state *state, float *start, float *end);
-/* Using additional shader constants (uniforms in GLSL / program environment - * or local parameters in ARB) is costly: - * ARB only knows float4 parameters and GLSL compiler are not really smart - * when it comes to efficiently pack float2 uniforms, so no space is wasted - * (in fact most compilers map a float2 to a full float4 uniform). - * - * For NP2 texcoord fixup we only need 2 floats (width and height) for each - * 2D texture used in the shader. We therefore pack fixup info for 2 textures - * into a single shader constant (uniform / program parameter). - * - * This structure is shared between the GLSL and the ARB backend.*/ -struct ps_np2fixup_info { - unsigned char idx[WINED3D_MAX_FRAGMENT_SAMPLERS]; /* indices to the real constant */ - WORD active; /* bitfield indicating if we can apply the fixup */ - WORD num_consts; -}; - struct wined3d_palette { LONG ref;