wined3d: Renumber WINED3DTEXTURESTAGESTATETYPE enum elements.
Saves some space by not having unused entries is the arrays tracking these states.
This commit is contained in:
parent
352e60e6ed
commit
a8697d90e4
|
@ -2421,7 +2421,7 @@ static void state_arb_specularenable(DWORD state, IWineD3DStateBlockImpl *stateb
|
|||
}
|
||||
|
||||
static void set_bumpmat_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
|
||||
float mat[2][2];
|
||||
|
||||
|
@ -2456,7 +2456,7 @@ static void set_bumpmat_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, W
|
|||
}
|
||||
|
||||
static void tex_bumpenvlum_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
|
||||
float param[4];
|
||||
|
||||
|
|
|
@ -853,7 +853,7 @@ static void state_texfactor_atifs(DWORD state, IWineD3DStateBlockImpl *statebloc
|
|||
}
|
||||
|
||||
static void set_bumpmat(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
float mat[2][2];
|
||||
|
||||
mat[0][0] = *((float *) &stateblock->textureState[stage][WINED3DTSS_BUMPENVMAT00]);
|
||||
|
|
|
@ -416,7 +416,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface,
|
|||
}
|
||||
object->num_contained_ps_consts_b = MAX_CONST_B;
|
||||
for(i = 0; i < MAX_TEXTURES; i++) {
|
||||
for(j = 1; j <= WINED3D_HIGHEST_TEXTURE_STATE; j++) {
|
||||
for (j = 0; j <= WINED3D_HIGHEST_TEXTURE_STATE; ++j)
|
||||
{
|
||||
object->contained_tss_states[object->num_contained_tss_states].stage = i;
|
||||
object->contained_tss_states[object->num_contained_tss_states].state = j;
|
||||
object->num_contained_tss_states++;
|
||||
|
@ -3619,7 +3620,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantF(
|
|||
|
||||
static inline void markTextureStagesDirty(IWineD3DDeviceImpl *This, DWORD stage) {
|
||||
DWORD i;
|
||||
for(i = 0; i < WINED3D_HIGHEST_TEXTURE_STATE; i++) {
|
||||
for(i = 0; i <= WINED3D_HIGHEST_TEXTURE_STATE; ++i)
|
||||
{
|
||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, i));
|
||||
}
|
||||
}
|
||||
|
@ -4814,7 +4816,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EndStateBlock(IWineD3DDevice *iface, IW
|
|||
}
|
||||
}
|
||||
for(i = 0; i < MAX_TEXTURES; i++) {
|
||||
for(j = 1; j <= WINED3D_HIGHEST_TEXTURE_STATE; j++) {
|
||||
for (j = 0; j <= WINED3D_HIGHEST_TEXTURE_STATE; ++j)
|
||||
{
|
||||
if(object->changed.textureState[i][j]) {
|
||||
object->contained_tss_states[object->num_contained_tss_states].stage = i;
|
||||
object->contained_tss_states[object->num_contained_tss_states].state = j;
|
||||
|
|
|
@ -451,7 +451,7 @@ void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEX
|
|||
|
||||
|
||||
static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
|
||||
BOOL tex_used = stateblock->wineD3DDevice->fixed_function_usage_map & (1 << stage);
|
||||
|
||||
|
@ -556,7 +556,7 @@ static void nvts_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
|
|||
}
|
||||
|
||||
static void nvts_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage + 1];
|
||||
float mat[2][2];
|
||||
|
||||
|
|
|
@ -2881,7 +2881,7 @@ static void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, WINED3DTE
|
|||
|
||||
|
||||
static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
|
||||
BOOL tex_used = stateblock->wineD3DDevice->fixed_function_usage_map & (1 << stage);
|
||||
|
||||
|
@ -2937,7 +2937,7 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
|
|||
}
|
||||
|
||||
void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
|
||||
BOOL tex_used = stateblock->wineD3DDevice->fixed_function_usage_map & (1 << stage);
|
||||
DWORD op, arg1, arg2, arg0;
|
||||
|
@ -3036,7 +3036,7 @@ void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext
|
|||
}
|
||||
|
||||
static void transform_texture(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
DWORD texUnit = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
||||
DWORD texUnit = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[texUnit];
|
||||
BOOL generated;
|
||||
int coordIdx;
|
||||
|
@ -3134,7 +3134,7 @@ static void loadTexCoords(IWineD3DStateBlockImpl *stateblock, const WineDirect3D
|
|||
}
|
||||
|
||||
static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
|
||||
static const GLfloat s_plane[] = { 1.0, 0.0, 0.0, 0.0 };
|
||||
static const GLfloat t_plane[] = { 0.0, 1.0, 0.0, 0.0 };
|
||||
|
@ -3315,7 +3315,7 @@ static void shaderconstant(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
|
|||
}
|
||||
|
||||
static void tex_bumpenvlscale(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
|
||||
if(stateblock->pixelShader && stage != 0 &&
|
||||
((IWineD3DPixelShaderImpl *) stateblock->pixelShader)->baseShader.reg_maps.luminanceparams[stage]) {
|
||||
|
@ -3488,7 +3488,7 @@ void apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DC
|
|||
}
|
||||
|
||||
static void shader_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
if(stateblock->pixelShader && stage != 0 &&
|
||||
((IWineD3DPixelShaderImpl *) stateblock->pixelShader)->baseShader.reg_maps.bumpmat[stage]) {
|
||||
/* The pixel shader has to know the bump env matrix. Do a constants update if it isn't scheduled
|
||||
|
|
|
@ -998,7 +998,8 @@ should really perform a delta so that only the changes get updated*/
|
|||
IWineD3DDevice_SetRenderState(pDevice, i, This->renderState[i]);
|
||||
}
|
||||
for(j = 0; j < MAX_TEXTURES; j++) {
|
||||
for(i = 1; i <= WINED3D_HIGHEST_TEXTURE_STATE; i++) {
|
||||
for (i = 0; i <= WINED3D_HIGHEST_TEXTURE_STATE; ++i)
|
||||
{
|
||||
IWineD3DDevice_SetTextureStageState(pDevice, j, i, This->textureState[j][i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1025,9 +1025,6 @@ const char* debug_d3dtexturestate(DWORD state) {
|
|||
D3DSTATE_TO_STR(WINED3DTSS_RESULTARG );
|
||||
D3DSTATE_TO_STR(WINED3DTSS_CONSTANT );
|
||||
#undef D3DSTATE_TO_STR
|
||||
case 12:
|
||||
/* Note WINED3DTSS are not consecutive, so skip these */
|
||||
return "unused";
|
||||
default:
|
||||
FIXME("Unrecognized %u texture state!\n", state);
|
||||
return "unrecognized";
|
||||
|
|
|
@ -680,7 +680,7 @@ typedef void (*APPLYSTATEFUNC)(DWORD state, IWineD3DStateBlockImpl *stateblock,
|
|||
#define STATE_RENDER(a) (a)
|
||||
#define STATE_IS_RENDER(a) ((a) >= STATE_RENDER(1) && (a) <= STATE_RENDER(WINEHIGHEST_RENDER_STATE))
|
||||
|
||||
#define STATE_TEXTURESTAGE(stage, num) (STATE_RENDER(WINEHIGHEST_RENDER_STATE) + (stage) * WINED3D_HIGHEST_TEXTURE_STATE + (num))
|
||||
#define STATE_TEXTURESTAGE(stage, num) (STATE_RENDER(WINEHIGHEST_RENDER_STATE) + 1 + (stage) * (WINED3D_HIGHEST_TEXTURE_STATE + 1) + (num))
|
||||
#define STATE_IS_TEXTURESTAGE(a) ((a) >= STATE_TEXTURESTAGE(0, 1) && (a) <= STATE_TEXTURESTAGE(MAX_TEXTURES - 1, WINED3D_HIGHEST_TEXTURE_STATE))
|
||||
|
||||
/* + 1 because samplers start with 0 */
|
||||
|
@ -1883,7 +1883,7 @@ struct IWineD3DStateBlockImpl
|
|||
unsigned int num_contained_ps_consts_b;
|
||||
DWORD *contained_ps_consts_f;
|
||||
unsigned int num_contained_ps_consts_f;
|
||||
struct StageState contained_tss_states[MAX_TEXTURES * (WINED3D_HIGHEST_TEXTURE_STATE)];
|
||||
struct StageState contained_tss_states[MAX_TEXTURES * (WINED3D_HIGHEST_TEXTURE_STATE + 1)];
|
||||
unsigned int num_contained_tss_states;
|
||||
struct StageState contained_sampler_states[MAX_COMBINED_SAMPLERS * WINED3D_HIGHEST_SAMPLER_STATE];
|
||||
unsigned int num_contained_sampler_states;
|
||||
|
|
|
@ -554,24 +554,24 @@ typedef enum _WINED3DMULTISAMPLE_TYPE
|
|||
|
||||
typedef enum _WINED3DTEXTURESTAGESTATETYPE
|
||||
{
|
||||
WINED3DTSS_COLOROP = 1,
|
||||
WINED3DTSS_COLORARG1 = 2,
|
||||
WINED3DTSS_COLORARG2 = 3,
|
||||
WINED3DTSS_ALPHAOP = 4,
|
||||
WINED3DTSS_ALPHAARG1 = 5,
|
||||
WINED3DTSS_ALPHAARG2 = 6,
|
||||
WINED3DTSS_BUMPENVMAT00 = 7,
|
||||
WINED3DTSS_BUMPENVMAT01 = 8,
|
||||
WINED3DTSS_BUMPENVMAT10 = 9,
|
||||
WINED3DTSS_BUMPENVMAT11 = 10,
|
||||
WINED3DTSS_TEXCOORDINDEX = 11,
|
||||
WINED3DTSS_BUMPENVLSCALE = 22,
|
||||
WINED3DTSS_BUMPENVLOFFSET = 23,
|
||||
WINED3DTSS_TEXTURETRANSFORMFLAGS = 24,
|
||||
WINED3DTSS_COLORARG0 = 26,
|
||||
WINED3DTSS_ALPHAARG0 = 27,
|
||||
WINED3DTSS_RESULTARG = 28,
|
||||
WINED3DTSS_CONSTANT = 32,
|
||||
WINED3DTSS_COLOROP = 0,
|
||||
WINED3DTSS_COLORARG1 = 1,
|
||||
WINED3DTSS_COLORARG2 = 2,
|
||||
WINED3DTSS_ALPHAOP = 3,
|
||||
WINED3DTSS_ALPHAARG1 = 4,
|
||||
WINED3DTSS_ALPHAARG2 = 5,
|
||||
WINED3DTSS_BUMPENVMAT00 = 6,
|
||||
WINED3DTSS_BUMPENVMAT01 = 7,
|
||||
WINED3DTSS_BUMPENVMAT10 = 8,
|
||||
WINED3DTSS_BUMPENVMAT11 = 9,
|
||||
WINED3DTSS_TEXCOORDINDEX = 10,
|
||||
WINED3DTSS_BUMPENVLSCALE = 11,
|
||||
WINED3DTSS_BUMPENVLOFFSET = 12,
|
||||
WINED3DTSS_TEXTURETRANSFORMFLAGS = 13,
|
||||
WINED3DTSS_COLORARG0 = 14,
|
||||
WINED3DTSS_ALPHAARG0 = 15,
|
||||
WINED3DTSS_RESULTARG = 16,
|
||||
WINED3DTSS_CONSTANT = 17,
|
||||
WINED3DTSS_FORCE_DWORD = 0x7fffffff
|
||||
} WINED3DTEXTURESTAGESTATETYPE;
|
||||
const UINT WINED3D_HIGHEST_TEXTURE_STATE = WINED3DTSS_CONSTANT;
|
||||
|
|
Loading…
Reference in New Issue