wined3d: Store vertex shader integer constants as wined3d_ivec4 structures.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4f1acfebf5
commit
43c31e68be
@ -625,9 +625,9 @@ static void shader_arb_vs_local_constants(const struct arb_vs_compiled_shader *g
|
|||||||
if(gl_shader->int_consts[i] != WINED3D_CONST_NUM_UNUSED)
|
if(gl_shader->int_consts[i] != WINED3D_CONST_NUM_UNUSED)
|
||||||
{
|
{
|
||||||
float val[4];
|
float val[4];
|
||||||
val[0] = (float)state->vs_consts_i[4 * i];
|
val[0] = (float)state->vs_consts_i[i].x;
|
||||||
val[1] = (float)state->vs_consts_i[4 * i + 1];
|
val[1] = (float)state->vs_consts_i[i].y;
|
||||||
val[2] = (float)state->vs_consts_i[4 * i + 2];
|
val[2] = (float)state->vs_consts_i[i].z;
|
||||||
val[3] = -1.0f;
|
val[3] = -1.0f;
|
||||||
|
|
||||||
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, gl_shader->int_consts[i], val));
|
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, gl_shader->int_consts[i], val));
|
||||||
@ -4675,9 +4675,9 @@ static void find_arb_vs_compile_args(const struct wined3d_state *state,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
args->loop_ctrl[i][0] = state->vs_consts_i[i * 4];
|
args->loop_ctrl[i][0] = state->vs_consts_i[i].x;
|
||||||
args->loop_ctrl[i][1] = state->vs_consts_i[i * 4 + 1];
|
args->loop_ctrl[i][1] = state->vs_consts_i[i].y;
|
||||||
args->loop_ctrl[i][2] = state->vs_consts_i[i * 4 + 2];
|
args->loop_ctrl[i][2] = state->vs_consts_i[i].z;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2430,7 +2430,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device,
|
|||||||
if (!constants || start_register >= WINED3D_MAX_CONSTS_I)
|
if (!constants || start_register >= WINED3D_MAX_CONSTS_I)
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
|
||||||
memcpy(&device->update_state->vs_consts_i[start_register * 4], constants, count * sizeof(int) * 4);
|
memcpy(&device->update_state->vs_consts_i[start_register], constants, count * sizeof(int) * 4);
|
||||||
for (i = 0; i < count; ++i)
|
for (i = 0; i < count; ++i)
|
||||||
TRACE("Set INT constant %u to {%d, %d, %d, %d}.\n", start_register + i,
|
TRACE("Set INT constant %u to {%d, %d, %d, %d}.\n", start_register + i,
|
||||||
constants[i * 4], constants[i * 4 + 1],
|
constants[i * 4], constants[i * 4 + 1],
|
||||||
@ -2460,7 +2460,7 @@ HRESULT CDECL wined3d_device_get_vs_consts_i(const struct wined3d_device *device
|
|||||||
if (!constants || start_register >= WINED3D_MAX_CONSTS_I)
|
if (!constants || start_register >= WINED3D_MAX_CONSTS_I)
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
|
||||||
memcpy(constants, &device->state.vs_consts_i[start_register * 4], count * sizeof(int) * 4);
|
memcpy(constants, &device->state.vs_consts_i[start_register], count * sizeof(int) * 4);
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,8 +728,8 @@ static void shader_glsl_load_constants_f(const struct wined3d_shader *shader, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Context activation is done by the caller. */
|
/* Context activation is done by the caller. */
|
||||||
static void shader_glsl_load_constantsI(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info,
|
static void shader_glsl_load_constants_i(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info,
|
||||||
const GLint locations[WINED3D_MAX_CONSTS_I], const int *constants, WORD constants_set)
|
const struct wined3d_ivec4 *constants, const GLint locations[WINED3D_MAX_CONSTS_I], WORD constants_set)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
struct list* ptr;
|
struct list* ptr;
|
||||||
@ -739,7 +739,7 @@ static void shader_glsl_load_constantsI(const struct wined3d_shader *shader, con
|
|||||||
if (!(constants_set & 1)) continue;
|
if (!(constants_set & 1)) continue;
|
||||||
|
|
||||||
/* We found this uniform name in the program - go ahead and send the data */
|
/* We found this uniform name in the program - go ahead and send the data */
|
||||||
GL_EXTCALL(glUniform4iv(locations[i], 1, &constants[i * 4]));
|
GL_EXTCALL(glUniform4iv(locations[i], 1, &constants[i].x));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load immediate constants */
|
/* Load immediate constants */
|
||||||
@ -1335,8 +1335,8 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
|||||||
prog->vs.uniform_f_locations, &priv->vconst_heap, priv->stack, constant_version);
|
prog->vs.uniform_f_locations, &priv->vconst_heap, priv->stack, constant_version);
|
||||||
|
|
||||||
if (update_mask & WINED3D_SHADER_CONST_VS_I)
|
if (update_mask & WINED3D_SHADER_CONST_VS_I)
|
||||||
shader_glsl_load_constantsI(vshader, gl_info, prog->vs.uniform_i_locations, state->vs_consts_i,
|
shader_glsl_load_constants_i(vshader, gl_info, state->vs_consts_i,
|
||||||
vshader->reg_maps.integer_constants);
|
prog->vs.uniform_i_locations, vshader->reg_maps.integer_constants);
|
||||||
|
|
||||||
if (update_mask & WINED3D_SHADER_CONST_VS_B)
|
if (update_mask & WINED3D_SHADER_CONST_VS_B)
|
||||||
shader_glsl_load_constantsB(vshader, gl_info, prog->vs.uniform_b_locations, state->vs_consts_b,
|
shader_glsl_load_constantsB(vshader, gl_info, prog->vs.uniform_b_locations, state->vs_consts_b,
|
||||||
@ -1408,8 +1408,8 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
|||||||
prog->ps.uniform_f_locations, &priv->pconst_heap, priv->stack, constant_version);
|
prog->ps.uniform_f_locations, &priv->pconst_heap, priv->stack, constant_version);
|
||||||
|
|
||||||
if (update_mask & WINED3D_SHADER_CONST_PS_I)
|
if (update_mask & WINED3D_SHADER_CONST_PS_I)
|
||||||
shader_glsl_load_constantsI(pshader, gl_info, prog->ps.uniform_i_locations, state->ps_consts_i,
|
shader_glsl_load_constants_i(pshader, gl_info, (const struct wined3d_ivec4 *)state->ps_consts_i,
|
||||||
pshader->reg_maps.integer_constants);
|
prog->ps.uniform_i_locations, pshader->reg_maps.integer_constants);
|
||||||
|
|
||||||
if (update_mask & WINED3D_SHADER_CONST_PS_B)
|
if (update_mask & WINED3D_SHADER_CONST_PS_B)
|
||||||
shader_glsl_load_constantsB(pshader, gl_info, prog->ps.uniform_b_locations, state->ps_consts_b,
|
shader_glsl_load_constantsB(pshader, gl_info, prog->ps.uniform_b_locations, state->ps_consts_b,
|
||||||
|
@ -643,16 +643,9 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
|
|||||||
{
|
{
|
||||||
unsigned int idx = stateblock->contained_vs_consts_i[i];
|
unsigned int idx = stateblock->contained_vs_consts_i[i];
|
||||||
|
|
||||||
TRACE("Setting vs_consts[%u] to {%d, %d, %d, %d}.\n", idx,
|
TRACE("Setting vs_consts[%u] to %s.\n", idx, debug_ivec4(&src_state->vs_consts_i[idx]));
|
||||||
src_state->vs_consts_i[idx * 4 + 0],
|
|
||||||
src_state->vs_consts_i[idx * 4 + 1],
|
|
||||||
src_state->vs_consts_i[idx * 4 + 2],
|
|
||||||
src_state->vs_consts_i[idx * 4 + 3]);
|
|
||||||
|
|
||||||
stateblock->state.vs_consts_i[idx * 4 + 0] = src_state->vs_consts_i[idx * 4 + 0];
|
stateblock->state.vs_consts_i[idx] = src_state->vs_consts_i[idx];
|
||||||
stateblock->state.vs_consts_i[idx * 4 + 1] = src_state->vs_consts_i[idx * 4 + 1];
|
|
||||||
stateblock->state.vs_consts_i[idx * 4 + 2] = src_state->vs_consts_i[idx * 4 + 2];
|
|
||||||
stateblock->state.vs_consts_i[idx * 4 + 3] = src_state->vs_consts_i[idx * 4 + 3];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Vertex shader boolean constants. */
|
/* Vertex shader boolean constants. */
|
||||||
@ -919,7 +912,7 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
|
|||||||
for (i = 0; i < stateblock->num_contained_vs_consts_i; ++i)
|
for (i = 0; i < stateblock->num_contained_vs_consts_i; ++i)
|
||||||
{
|
{
|
||||||
wined3d_device_set_vs_consts_i(device, stateblock->contained_vs_consts_i[i],
|
wined3d_device_set_vs_consts_i(device, stateblock->contained_vs_consts_i[i],
|
||||||
stateblock->state.vs_consts_i + stateblock->contained_vs_consts_i[i] * 4, 1);
|
&stateblock->state.vs_consts_i[stateblock->contained_vs_consts_i[i]].x, 1);
|
||||||
}
|
}
|
||||||
for (i = 0; i < stateblock->num_contained_vs_consts_b; ++i)
|
for (i = 0; i < stateblock->num_contained_vs_consts_b; ++i)
|
||||||
{
|
{
|
||||||
|
@ -3365,6 +3365,14 @@ const char *debug_color(const struct wined3d_color *color)
|
|||||||
color->r, color->g, color->b, color->a);
|
color->r, color->g, color->b, color->a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *debug_ivec4(const struct wined3d_ivec4 *v)
|
||||||
|
{
|
||||||
|
if (!v)
|
||||||
|
return "(null)";
|
||||||
|
return wine_dbg_sprintf("{%d, %d, %d, %d}",
|
||||||
|
v->x, v->y, v->z, v->w);
|
||||||
|
}
|
||||||
|
|
||||||
const char *debug_vec4(const struct wined3d_vec4 *v)
|
const char *debug_vec4(const struct wined3d_vec4 *v)
|
||||||
{
|
{
|
||||||
if (!v)
|
if (!v)
|
||||||
|
@ -2213,7 +2213,7 @@ struct wined3d_state
|
|||||||
struct wined3d_shader_resource_view *shader_resource_view[WINED3D_SHADER_TYPE_COUNT][MAX_SHADER_RESOURCE_VIEWS];
|
struct wined3d_shader_resource_view *shader_resource_view[WINED3D_SHADER_TYPE_COUNT][MAX_SHADER_RESOURCE_VIEWS];
|
||||||
|
|
||||||
BOOL vs_consts_b[MAX_CONST_B];
|
BOOL vs_consts_b[MAX_CONST_B];
|
||||||
INT vs_consts_i[WINED3D_MAX_CONSTS_I * 4];
|
struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I];
|
||||||
struct wined3d_vec4 vs_consts_f[WINED3D_MAX_VS_CONSTS_F];
|
struct wined3d_vec4 vs_consts_f[WINED3D_MAX_VS_CONSTS_F];
|
||||||
|
|
||||||
BOOL ps_consts_b[MAX_CONST_B];
|
BOOL ps_consts_b[MAX_CONST_B];
|
||||||
@ -3103,6 +3103,7 @@ const char *debug_d3dpool(enum wined3d_pool pool) DECLSPEC_HIDDEN;
|
|||||||
const char *debug_fboattachment(GLenum attachment) DECLSPEC_HIDDEN;
|
const char *debug_fboattachment(GLenum attachment) DECLSPEC_HIDDEN;
|
||||||
const char *debug_fbostatus(GLenum status) DECLSPEC_HIDDEN;
|
const char *debug_fbostatus(GLenum status) DECLSPEC_HIDDEN;
|
||||||
const char *debug_glerror(GLenum error) DECLSPEC_HIDDEN;
|
const char *debug_glerror(GLenum error) DECLSPEC_HIDDEN;
|
||||||
|
const char *debug_ivec4(const struct wined3d_ivec4 *v) DECLSPEC_HIDDEN;
|
||||||
const char *debug_shader_type(enum wined3d_shader_type shader_type) DECLSPEC_HIDDEN;
|
const char *debug_shader_type(enum wined3d_shader_type shader_type) DECLSPEC_HIDDEN;
|
||||||
const char *debug_vec4(const struct wined3d_vec4 *v) DECLSPEC_HIDDEN;
|
const char *debug_vec4(const struct wined3d_vec4 *v) DECLSPEC_HIDDEN;
|
||||||
void dump_color_fixup_desc(struct color_fixup_desc fixup) DECLSPEC_HIDDEN;
|
void dump_color_fixup_desc(struct color_fixup_desc fixup) DECLSPEC_HIDDEN;
|
||||||
|
@ -1505,6 +1505,14 @@ struct wined3d_vec4
|
|||||||
float w;
|
float w;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct wined3d_ivec4
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int z;
|
||||||
|
int w;
|
||||||
|
};
|
||||||
|
|
||||||
struct wined3d_matrix
|
struct wined3d_matrix
|
||||||
{
|
{
|
||||||
float _11, _12, _13, _14;
|
float _11, _12, _13, _14;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user