mirror of
https://github.com/reactos/wine.git
synced 2025-01-26 22:24:37 +00:00
wined3d: Store usage and usage_idx in struct wined3d_shader_semantic.
Instead of the usage token.
This commit is contained in:
parent
a1dedbdf58
commit
9ec0b09d35
@ -297,13 +297,17 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m
|
|||||||
else
|
else
|
||||||
reg_maps->packed_input[regnum] = 1;
|
reg_maps->packed_input[regnum] = 1;
|
||||||
|
|
||||||
semantics_in[regnum].usage = usage;
|
semantics_in[regnum].usage = (usage & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT;
|
||||||
|
semantics_in[regnum].usage_idx =
|
||||||
|
(usage & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT;
|
||||||
shader_parse_dst_param(param, 0, &semantics_in[regnum].reg);
|
shader_parse_dst_param(param, 0, &semantics_in[regnum].reg);
|
||||||
|
|
||||||
/* Vshader: mark 3.0 output registers used, save token */
|
/* Vshader: mark 3.0 output registers used, save token */
|
||||||
} else if (WINED3DSPR_OUTPUT == regtype) {
|
} else if (WINED3DSPR_OUTPUT == regtype) {
|
||||||
reg_maps->packed_output[regnum] = 1;
|
reg_maps->packed_output[regnum] = 1;
|
||||||
semantics_out[regnum].usage = usage;
|
semantics_out[regnum].usage = (usage & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT;
|
||||||
|
semantics_out[regnum].usage_idx =
|
||||||
|
(usage & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT;
|
||||||
shader_parse_dst_param(param, 0, &semantics_out[regnum].reg);
|
shader_parse_dst_param(param, 0, &semantics_out[regnum].reg);
|
||||||
|
|
||||||
if (usage & (WINED3DDECLUSAGE_FOG << WINED3DSP_DCL_USAGE_SHIFT))
|
if (usage & (WINED3DDECLUSAGE_FOG << WINED3DSP_DCL_USAGE_SHIFT))
|
||||||
|
@ -3002,16 +3002,14 @@ static void pshader_glsl_input_pack(IWineD3DPixelShader *iface, SHADER_BUFFER *b
|
|||||||
|
|
||||||
for (i = 0; i < MAX_REG_INPUT; ++i)
|
for (i = 0; i < MAX_REG_INPUT; ++i)
|
||||||
{
|
{
|
||||||
DWORD usage_token;
|
|
||||||
DWORD usage, usage_idx;
|
DWORD usage, usage_idx;
|
||||||
char reg_mask[6];
|
char reg_mask[6];
|
||||||
|
|
||||||
/* Unused */
|
/* Unused */
|
||||||
if (!reg_maps->packed_input[i]) continue;
|
if (!reg_maps->packed_input[i]) continue;
|
||||||
|
|
||||||
usage_token = semantics_in[i].usage;
|
usage = semantics_in[i].usage;
|
||||||
usage = (usage_token & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT;
|
usage_idx = semantics_in[i].usage_idx;
|
||||||
usage_idx = (usage_token & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT;
|
|
||||||
shader_glsl_get_write_mask(semantics_in[i].reg.token, reg_mask);
|
shader_glsl_get_write_mask(semantics_in[i].reg.token, reg_mask);
|
||||||
|
|
||||||
switch (usage)
|
switch (usage)
|
||||||
@ -3099,7 +3097,6 @@ static void handle_ps3_input(SHADER_BUFFER *buffer, const WineD3D_GL_Info *gl_in
|
|||||||
const struct wined3d_shader_semantic *semantics_out, const struct shader_reg_maps *reg_maps_out)
|
const struct wined3d_shader_semantic *semantics_out, const struct shader_reg_maps *reg_maps_out)
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
DWORD usage_token, usage_token_out;
|
|
||||||
DWORD usage, usage_idx, usage_out, usage_idx_out;
|
DWORD usage, usage_idx, usage_out, usage_idx_out;
|
||||||
DWORD *set;
|
DWORD *set;
|
||||||
DWORD in_idx;
|
DWORD in_idx;
|
||||||
@ -3137,9 +3134,8 @@ static void handle_ps3_input(SHADER_BUFFER *buffer, const WineD3D_GL_Info *gl_in
|
|||||||
sprintf(destination, "IN[%u]", in_idx);
|
sprintf(destination, "IN[%u]", in_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
usage_token = semantics_in[i].usage;
|
usage = semantics_in[i].usage;
|
||||||
usage = (usage_token & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT;
|
usage_idx = semantics_in[i].usage_idx;
|
||||||
usage_idx = (usage_token & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT;
|
|
||||||
set[map[i]] = shader_glsl_get_write_mask(semantics_in[i].reg.token, reg_mask);
|
set[map[i]] = shader_glsl_get_write_mask(semantics_in[i].reg.token, reg_mask);
|
||||||
|
|
||||||
if(!semantics_out) {
|
if(!semantics_out) {
|
||||||
@ -3180,9 +3176,8 @@ static void handle_ps3_input(SHADER_BUFFER *buffer, const WineD3D_GL_Info *gl_in
|
|||||||
for(j = 0; j < MAX_REG_OUTPUT; j++) {
|
for(j = 0; j < MAX_REG_OUTPUT; j++) {
|
||||||
if (!reg_maps_out->packed_output[j]) continue;
|
if (!reg_maps_out->packed_output[j]) continue;
|
||||||
|
|
||||||
usage_token_out = semantics_out[j].usage;
|
usage_out = semantics_out[j].usage;
|
||||||
usage_out = (usage_token_out & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT;
|
usage_idx_out = semantics_out[j].usage_idx;
|
||||||
usage_idx_out = (usage_token_out & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT;
|
|
||||||
shader_glsl_get_write_mask(semantics_out[j].reg.token, reg_mask_out);
|
shader_glsl_get_write_mask(semantics_out[j].reg.token, reg_mask_out);
|
||||||
|
|
||||||
if(usage == usage_out &&
|
if(usage == usage_out &&
|
||||||
@ -3254,7 +3249,6 @@ static GLhandleARB generate_param_reorder_function(IWineD3DVertexShader *vertexs
|
|||||||
DWORD ps_major = ps ? WINED3DSHADER_VERSION_MAJOR(ps->baseShader.reg_maps.shader_version) : 0;
|
DWORD ps_major = ps ? WINED3DSHADER_VERSION_MAJOR(ps->baseShader.reg_maps.shader_version) : 0;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
SHADER_BUFFER buffer;
|
SHADER_BUFFER buffer;
|
||||||
DWORD usage_token;
|
|
||||||
DWORD usage, usage_idx, writemask;
|
DWORD usage, usage_idx, writemask;
|
||||||
char reg_mask[6];
|
char reg_mask[6];
|
||||||
const struct wined3d_shader_semantic *semantics_out, *semantics_in;
|
const struct wined3d_shader_semantic *semantics_out, *semantics_in;
|
||||||
@ -3289,9 +3283,8 @@ static GLhandleARB generate_param_reorder_function(IWineD3DVertexShader *vertexs
|
|||||||
for(i = 0; i < MAX_REG_OUTPUT; i++) {
|
for(i = 0; i < MAX_REG_OUTPUT; i++) {
|
||||||
if (!vs->baseShader.reg_maps.packed_output[i]) continue;
|
if (!vs->baseShader.reg_maps.packed_output[i]) continue;
|
||||||
|
|
||||||
usage_token = semantics_out[i].usage;
|
usage = semantics_out[i].usage;
|
||||||
usage = (usage_token & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT;
|
usage_idx = semantics_out[i].usage_idx;
|
||||||
usage_idx = (usage_token & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT;
|
|
||||||
writemask = shader_glsl_get_write_mask(semantics_out[i].reg.token, reg_mask);
|
writemask = shader_glsl_get_write_mask(semantics_out[i].reg.token, reg_mask);
|
||||||
|
|
||||||
switch(usage) {
|
switch(usage) {
|
||||||
@ -3344,9 +3337,8 @@ static GLhandleARB generate_param_reorder_function(IWineD3DVertexShader *vertexs
|
|||||||
for(i = 0; i < MAX_REG_OUTPUT; i++) {
|
for(i = 0; i < MAX_REG_OUTPUT; i++) {
|
||||||
if (!vs->baseShader.reg_maps.packed_output[i]) continue;
|
if (!vs->baseShader.reg_maps.packed_output[i]) continue;
|
||||||
|
|
||||||
usage_token = semantics_out[i].usage;
|
usage = semantics_out[i].usage;
|
||||||
usage = (usage_token & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT;
|
usage_idx = semantics_out[i].usage_idx;
|
||||||
usage_idx = (usage_token & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT;
|
|
||||||
shader_glsl_get_write_mask(semantics_out[i].reg.token, reg_mask);
|
shader_glsl_get_write_mask(semantics_out[i].reg.token, reg_mask);
|
||||||
|
|
||||||
switch(usage) {
|
switch(usage) {
|
||||||
|
@ -174,15 +174,12 @@ static void vshader_set_input(
|
|||||||
unsigned int regnum,
|
unsigned int regnum,
|
||||||
BYTE usage, BYTE usage_idx) {
|
BYTE usage, BYTE usage_idx) {
|
||||||
|
|
||||||
/* Fake usage: set reserved bit, usage, usage_idx */
|
|
||||||
DWORD usage_token = (0x1 << 31) |
|
|
||||||
(usage << WINED3DSP_DCL_USAGE_SHIFT) | (usage_idx << WINED3DSP_DCL_USAGEINDEX_SHIFT);
|
|
||||||
|
|
||||||
/* Fake register; set reserved bit, regnum, type: input, wmask: all */
|
/* Fake register; set reserved bit, regnum, type: input, wmask: all */
|
||||||
DWORD reg_token = (0x1 << 31) |
|
DWORD reg_token = (0x1 << 31) |
|
||||||
WINED3DSP_WRITEMASK_ALL | (WINED3DSPR_INPUT << WINED3DSP_REGTYPE_SHIFT) | regnum;
|
WINED3DSP_WRITEMASK_ALL | (WINED3DSPR_INPUT << WINED3DSP_REGTYPE_SHIFT) | regnum;
|
||||||
|
|
||||||
This->semantics_in[regnum].usage = usage_token;
|
This->semantics_in[regnum].usage = usage;
|
||||||
|
This->semantics_in[regnum].usage_idx = usage_idx;
|
||||||
This->semantics_in[regnum].reg.register_type = WINED3DSPR_INPUT;
|
This->semantics_in[regnum].reg.register_type = WINED3DSPR_INPUT;
|
||||||
This->semantics_in[regnum].reg.register_idx = regnum;
|
This->semantics_in[regnum].reg.register_idx = regnum;
|
||||||
This->semantics_in[regnum].reg.write_mask = WINED3DSP_WRITEMASK_ALL;
|
This->semantics_in[regnum].reg.write_mask = WINED3DSP_WRITEMASK_ALL;
|
||||||
@ -209,15 +206,10 @@ BOOL vshader_get_input(
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < MAX_ATTRIBS; i++) {
|
for (i = 0; i < MAX_ATTRIBS; i++) {
|
||||||
DWORD usage_token, usage, usage_idx;
|
|
||||||
|
|
||||||
if (!This->baseShader.reg_maps.attributes[i]) continue;
|
if (!This->baseShader.reg_maps.attributes[i]) continue;
|
||||||
|
|
||||||
usage_token = This->semantics_in[i].usage;
|
if (match_usage(This->semantics_in[i].usage,
|
||||||
usage = (usage_token & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT;
|
This->semantics_in[i].usage_idx, usage_req, usage_idx_req))
|
||||||
usage_idx = (usage_token & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT;
|
|
||||||
|
|
||||||
if (match_usage(usage, usage_idx, usage_req, usage_idx_req))
|
|
||||||
{
|
{
|
||||||
*regnum = i;
|
*regnum = i;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -472,7 +472,8 @@ struct wined3d_shader_instruction
|
|||||||
|
|
||||||
struct wined3d_shader_semantic
|
struct wined3d_shader_semantic
|
||||||
{
|
{
|
||||||
DWORD usage;
|
WINED3DDECLUSAGE usage;
|
||||||
|
UINT usage_idx;
|
||||||
struct wined3d_shader_dst_param reg;
|
struct wined3d_shader_dst_param reg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user