wined3d: Get rid of the local_constant typedef.
This commit is contained in:
parent
fcf96b634a
commit
b49e08aa8d
|
@ -368,7 +368,7 @@ static unsigned int reserved_vs_const(const struct arb_vshader_private *shader_d
|
|||
static unsigned int shader_arb_load_constantsF(struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info,
|
||||
GLuint target_type, unsigned int max_constants, const float *constants, char *dirty_consts)
|
||||
{
|
||||
local_constant* lconst;
|
||||
struct wined3d_shader_lconst *lconst;
|
||||
DWORD i, j;
|
||||
unsigned int ret;
|
||||
|
||||
|
@ -458,7 +458,7 @@ static unsigned int shader_arb_load_constantsF(struct wined3d_shader *shader, co
|
|||
{
|
||||
if (TRACE_ON(d3d_shader))
|
||||
{
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry)
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, struct wined3d_shader_lconst, entry)
|
||||
{
|
||||
GLfloat* values = (GLfloat*)lconst->value;
|
||||
TRACE_(d3d_constants)("Loading local constants %i: %f, %f, %f, %f\n", lconst->idx,
|
||||
|
@ -467,7 +467,7 @@ static unsigned int shader_arb_load_constantsF(struct wined3d_shader *shader, co
|
|||
}
|
||||
/* Immediate constants are clamped for 1.X shaders at loading times */
|
||||
ret = 0;
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry)
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, struct wined3d_shader_lconst, entry)
|
||||
{
|
||||
dirty_consts[lconst->idx] = 1; /* Dirtify so the non-immediate constant overwrites it next time */
|
||||
ret = max(ret, lconst->idx + 1);
|
||||
|
@ -702,9 +702,9 @@ static void shader_arb_update_float_pixel_constants(struct wined3d_device *devic
|
|||
|
||||
static DWORD *local_const_mapping(const struct wined3d_shader *shader)
|
||||
{
|
||||
const struct wined3d_shader_lconst *lconst;
|
||||
DWORD *ret;
|
||||
DWORD idx = 0;
|
||||
const local_constant *lconst;
|
||||
|
||||
if (shader->load_local_constsF || list_empty(&shader->constantsF))
|
||||
return NULL;
|
||||
|
@ -716,7 +716,7 @@ static DWORD *local_const_mapping(const struct wined3d_shader *shader)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry)
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, struct wined3d_shader_lconst, entry)
|
||||
{
|
||||
ret[lconst->idx] = idx++;
|
||||
}
|
||||
|
@ -731,8 +731,8 @@ static DWORD shader_generate_arb_declarations(struct wined3d_shader *shader,
|
|||
{
|
||||
DWORD i, next_local = 0;
|
||||
char pshader = shader_is_pshader_version(reg_maps->shader_version.type);
|
||||
const struct wined3d_shader_lconst *lconst;
|
||||
unsigned max_constantsF;
|
||||
const local_constant *lconst;
|
||||
DWORD map;
|
||||
|
||||
/* In pixel shaders, all private constants are program local, we don't need anything
|
||||
|
@ -825,7 +825,7 @@ static DWORD shader_generate_arb_declarations(struct wined3d_shader *shader,
|
|||
*/
|
||||
if (lconst_map)
|
||||
{
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry)
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, struct wined3d_shader_lconst, entry)
|
||||
{
|
||||
shader_addline(buffer, "PARAM C%u = program.local[%u];\n", lconst->idx,
|
||||
lconst_map[lconst->idx]);
|
||||
|
@ -3429,9 +3429,9 @@ static void arbfp_add_sRGB_correction(struct wined3d_shader_buffer *buffer, cons
|
|||
|
||||
static const DWORD *find_loop_control_values(const struct wined3d_shader *shader, DWORD idx)
|
||||
{
|
||||
const local_constant *constant;
|
||||
const struct wined3d_shader_lconst *constant;
|
||||
|
||||
LIST_FOR_EACH_ENTRY(constant, &shader->constantsI, local_constant, entry)
|
||||
LIST_FOR_EACH_ENTRY(constant, &shader->constantsI, struct wined3d_shader_lconst, entry)
|
||||
{
|
||||
if (constant->idx == idx)
|
||||
{
|
||||
|
@ -3521,8 +3521,8 @@ static GLuint shader_arb_generate_pshader(struct wined3d_shader *shader,
|
|||
const struct arb_ps_compile_args *args, struct arb_ps_compiled_shader *compiled)
|
||||
{
|
||||
const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps;
|
||||
const struct wined3d_shader_lconst *lconst;
|
||||
const DWORD *function = shader->function;
|
||||
const local_constant *lconst;
|
||||
GLuint retval;
|
||||
char fragcolor[16];
|
||||
DWORD *lconst_map = local_const_mapping(shader), next_local;
|
||||
|
@ -3848,7 +3848,7 @@ static GLuint shader_arb_generate_pshader(struct wined3d_shader *shader,
|
|||
/* Load immediate constants */
|
||||
if (lconst_map)
|
||||
{
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry)
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, struct wined3d_shader_lconst, entry)
|
||||
{
|
||||
const float *value = (const float *)lconst->value;
|
||||
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, lconst_map[lconst->idx], value));
|
||||
|
@ -4108,8 +4108,8 @@ static GLuint shader_arb_generate_vshader(struct wined3d_shader *shader,
|
|||
{
|
||||
const struct arb_vshader_private *shader_data = shader->backend_data;
|
||||
const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps;
|
||||
const struct wined3d_shader_lconst *lconst;
|
||||
const DWORD *function = shader->function;
|
||||
const local_constant *lconst;
|
||||
GLuint ret;
|
||||
DWORD next_local, *lconst_map = local_const_mapping(shader);
|
||||
struct shader_arb_ctx_priv priv_ctx;
|
||||
|
@ -4255,7 +4255,7 @@ static GLuint shader_arb_generate_vshader(struct wined3d_shader *shader,
|
|||
/* Load immediate constants */
|
||||
if (lconst_map)
|
||||
{
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry)
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, struct wined3d_shader_lconst, entry)
|
||||
{
|
||||
const float *value = (const float *)lconst->value;
|
||||
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, lconst_map[lconst->idx], value));
|
||||
|
@ -5130,15 +5130,15 @@ static BOOL get_bool_const(const struct wined3d_shader_instruction *ins,
|
|||
{
|
||||
const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps;
|
||||
BOOL vshader = shader_is_vshader_version(reg_maps->shader_version.type);
|
||||
const struct wined3d_shader_lconst *constant;
|
||||
WORD bools = 0;
|
||||
WORD flag = (1 << idx);
|
||||
const local_constant *constant;
|
||||
struct shader_arb_ctx_priv *priv = ins->ctx->backend_data;
|
||||
|
||||
if (reg_maps->local_bool_consts & flag)
|
||||
{
|
||||
/* What good is a if(bool) with a hardcoded local constant? I don't know, but handle it */
|
||||
LIST_FOR_EACH_ENTRY(constant, &shader->constantsB, local_constant, entry)
|
||||
LIST_FOR_EACH_ENTRY(constant, &shader->constantsB, struct wined3d_shader_lconst, entry)
|
||||
{
|
||||
if (constant->idx == idx)
|
||||
{
|
||||
|
@ -5166,9 +5166,9 @@ static void get_loop_control_const(const struct wined3d_shader_instruction *ins,
|
|||
* type specific compile args. */
|
||||
if (reg_maps->local_int_consts & (1 << idx))
|
||||
{
|
||||
const local_constant *constant;
|
||||
const struct wined3d_shader_lconst *constant;
|
||||
|
||||
LIST_FOR_EACH_ENTRY(constant, &shader->constantsI, local_constant, entry)
|
||||
LIST_FOR_EACH_ENTRY(constant, &shader->constantsI, struct wined3d_shader_lconst, entry)
|
||||
{
|
||||
if (constant->idx == idx)
|
||||
{
|
||||
|
|
|
@ -517,7 +517,7 @@ static void shader_glsl_load_constantsF(const struct wined3d_shader *shader, con
|
|||
const float *constants, const GLint *constant_locations, const struct constant_heap *heap,
|
||||
unsigned char *stack, UINT version)
|
||||
{
|
||||
const local_constant *lconst;
|
||||
const struct wined3d_shader_lconst *lconst;
|
||||
|
||||
/* 1.X pshaders have the constants clamped to [-1;1] implicitly. */
|
||||
if (shader->reg_maps.shader_version.major == 1
|
||||
|
@ -533,7 +533,7 @@ static void shader_glsl_load_constantsF(const struct wined3d_shader *shader, con
|
|||
}
|
||||
|
||||
/* Immediate constants are clamped to [-1;1] at shader creation time if needed */
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry)
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, struct wined3d_shader_lconst, entry)
|
||||
{
|
||||
GLint location = constant_locations[lconst->idx];
|
||||
/* We found this uniform name in the program - go ahead and send the data */
|
||||
|
@ -566,7 +566,7 @@ static void shader_glsl_load_constantsI(const struct wined3d_shader *shader, con
|
|||
ptr = list_head(&shader->constantsI);
|
||||
while (ptr)
|
||||
{
|
||||
const struct local_constant *lconst = LIST_ENTRY(ptr, const struct local_constant, entry);
|
||||
const struct wined3d_shader_lconst *lconst = LIST_ENTRY(ptr, const struct wined3d_shader_lconst, entry);
|
||||
unsigned int idx = lconst->idx;
|
||||
const GLint *values = (const GLint *)lconst->value;
|
||||
|
||||
|
@ -636,7 +636,7 @@ static void shader_glsl_load_constantsB(const struct wined3d_shader *shader, con
|
|||
ptr = list_head(&shader->constantsB);
|
||||
while (ptr)
|
||||
{
|
||||
const struct local_constant *lconst = LIST_ENTRY(ptr, const struct local_constant, entry);
|
||||
const struct wined3d_shader_lconst *lconst = LIST_ENTRY(ptr, const struct wined3d_shader_lconst, entry);
|
||||
unsigned int idx = lconst->idx;
|
||||
const GLint *values = (const GLint *)lconst->value;
|
||||
|
||||
|
@ -901,7 +901,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
|||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
const struct wined3d_fb_state *fb = &shader->device->fb;
|
||||
unsigned int i, extra_constants_needed = 0;
|
||||
const local_constant *lconst;
|
||||
const struct wined3d_shader_lconst *lconst;
|
||||
DWORD map;
|
||||
|
||||
/* There are some minor differences between pixel and vertex shaders */
|
||||
|
@ -1179,7 +1179,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
|||
*/
|
||||
if (!shader->load_local_constsF)
|
||||
{
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry)
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, struct wined3d_shader_lconst, entry)
|
||||
{
|
||||
shader_addline(buffer, "uniform vec4 %cLC%u;\n", prefix, lconst->idx);
|
||||
}
|
||||
|
@ -2826,9 +2826,9 @@ static void shader_glsl_loop(const struct wined3d_shader_instruction *ins)
|
|||
{
|
||||
struct wined3d_shader_loop_state *loop_state = ins->ctx->loop_state;
|
||||
const struct wined3d_shader *shader = ins->ctx->shader;
|
||||
const struct wined3d_shader_lconst *constant;
|
||||
struct glsl_src_param src1_param;
|
||||
const DWORD *control_values = NULL;
|
||||
const local_constant *constant;
|
||||
|
||||
shader_glsl_add_src_param(ins, &ins->src[1], WINED3DSP_WRITEMASK_ALL, &src1_param);
|
||||
|
||||
|
@ -2839,7 +2839,7 @@ static void shader_glsl_loop(const struct wined3d_shader_instruction *ins)
|
|||
*/
|
||||
if (ins->src[1].reg.type == WINED3DSPR_CONSTINT)
|
||||
{
|
||||
LIST_FOR_EACH_ENTRY(constant, &shader->constantsI, local_constant, entry)
|
||||
LIST_FOR_EACH_ENTRY(constant, &shader->constantsI, struct wined3d_shader_lconst, entry)
|
||||
{
|
||||
if (constant->idx == ins->src[1].reg.idx)
|
||||
{
|
||||
|
@ -2911,14 +2911,14 @@ static void shader_glsl_rep(const struct wined3d_shader_instruction *ins)
|
|||
{
|
||||
const struct wined3d_shader *shader = ins->ctx->shader;
|
||||
struct wined3d_shader_loop_state *loop_state = ins->ctx->loop_state;
|
||||
const struct wined3d_shader_lconst *constant;
|
||||
struct glsl_src_param src0_param;
|
||||
const DWORD *control_values = NULL;
|
||||
const local_constant *constant;
|
||||
|
||||
/* Try to hardcode local values to help the GLSL compiler to unroll and optimize the loop */
|
||||
if (ins->src[0].reg.type == WINED3DSPR_CONSTINT)
|
||||
{
|
||||
LIST_FOR_EACH_ENTRY(constant, &shader->constantsI, local_constant, entry)
|
||||
LIST_FOR_EACH_ENTRY(constant, &shader->constantsI, struct wined3d_shader_lconst, entry)
|
||||
{
|
||||
if (constant->idx == ins->src[0].reg.idx)
|
||||
{
|
||||
|
@ -3950,12 +3950,12 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer
|
|||
static void hardcode_local_constants(const struct wined3d_shader *shader,
|
||||
const struct wined3d_gl_info *gl_info, GLhandleARB programId, char prefix)
|
||||
{
|
||||
const local_constant *lconst;
|
||||
const struct wined3d_shader_lconst *lconst;
|
||||
GLint tmp_loc;
|
||||
const float *value;
|
||||
char glsl_name[8];
|
||||
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry)
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, struct wined3d_shader_lconst, entry)
|
||||
{
|
||||
value = (const float *)lconst->value;
|
||||
snprintf(glsl_name, sizeof(glsl_name), "%cLC%u", prefix, lconst->idx);
|
||||
|
|
|
@ -327,13 +327,13 @@ static unsigned int shader_get_float_offset(WINED3DSHADER_PARAM_REGISTER_TYPE re
|
|||
|
||||
static void shader_delete_constant_list(struct list *clist)
|
||||
{
|
||||
struct local_constant *constant;
|
||||
struct wined3d_shader_lconst *constant;
|
||||
struct list *ptr;
|
||||
|
||||
ptr = list_head(clist);
|
||||
while (ptr)
|
||||
{
|
||||
constant = LIST_ENTRY(ptr, struct local_constant, entry);
|
||||
constant = LIST_ENTRY(ptr, struct wined3d_shader_lconst, entry);
|
||||
ptr = list_next(clist, ptr);
|
||||
HeapFree(GetProcessHeap(), 0, constant);
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
|
|||
struct wined3d_shader_src_param rel_addr;
|
||||
struct wined3d_shader_dst_param dst;
|
||||
|
||||
local_constant *lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
|
||||
struct wined3d_shader_lconst *lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(*lconst));
|
||||
if (!lconst) return E_OUTOFMEMORY;
|
||||
|
||||
fe->shader_read_dst_param(fe_data, &ptr, &dst, &rel_addr);
|
||||
|
@ -560,7 +560,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
|
|||
struct wined3d_shader_src_param rel_addr;
|
||||
struct wined3d_shader_dst_param dst;
|
||||
|
||||
local_constant *lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
|
||||
struct wined3d_shader_lconst *lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(*lconst));
|
||||
if (!lconst) return E_OUTOFMEMORY;
|
||||
|
||||
fe->shader_read_dst_param(fe_data, &ptr, &dst, &rel_addr);
|
||||
|
@ -577,7 +577,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
|
|||
struct wined3d_shader_src_param rel_addr;
|
||||
struct wined3d_shader_dst_param dst;
|
||||
|
||||
local_constant *lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
|
||||
struct wined3d_shader_lconst *lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(*lconst));
|
||||
if (!lconst) return E_OUTOFMEMORY;
|
||||
|
||||
fe->shader_read_dst_param(fe_data, &ptr, &dst, &rel_addr);
|
||||
|
@ -1705,7 +1705,7 @@ HRESULT CDECL wined3d_shader_set_local_constants_float(struct wined3d_shader *sh
|
|||
|
||||
for (i = start_idx; i < end_idx; ++i)
|
||||
{
|
||||
struct local_constant *lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
|
||||
struct wined3d_shader_lconst *lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(*lconst));
|
||||
if (!lconst)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
|
|
@ -2539,11 +2539,12 @@ unsigned int count_bits(unsigned int mask) DECLSPEC_HIDDEN;
|
|||
|
||||
void select_shader_mode(const struct wined3d_gl_info *gl_info, int *ps_selected, int *vs_selected) DECLSPEC_HIDDEN;
|
||||
|
||||
typedef struct local_constant {
|
||||
struct wined3d_shader_lconst
|
||||
{
|
||||
struct list entry;
|
||||
unsigned int idx;
|
||||
DWORD value[4];
|
||||
} local_constant;
|
||||
};
|
||||
|
||||
struct wined3d_shader_limits
|
||||
{
|
||||
|
@ -2711,12 +2712,12 @@ static inline void shader_get_position_fixup(const struct wined3d_context *conte
|
|||
|
||||
static inline BOOL shader_constant_is_local(const struct wined3d_shader *shader, DWORD reg)
|
||||
{
|
||||
struct local_constant *lconst;
|
||||
struct wined3d_shader_lconst *lconst;
|
||||
|
||||
if (shader->load_local_constsF)
|
||||
return FALSE;
|
||||
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry)
|
||||
LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, struct wined3d_shader_lconst, entry)
|
||||
{
|
||||
if (lconst->idx == reg)
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in New Issue