Henri Verbeet : wined3d: Don't compare const_num against -1.
Alexandre Julliard
julliard at winehq.org
Mon Mar 9 09:40:42 CDT 2009
Module: wine
Branch: master
Commit: 362bc0d694cefaeacc58a053b942dfae017e95e2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=362bc0d694cefaeacc58a053b942dfae017e95e2
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Mon Mar 9 14:31:28 2009 +0100
wined3d: Don't compare const_num against -1.
---
dlls/wined3d/arb_program_shader.c | 15 +++++++++++----
dlls/wined3d/wined3d_private.h | 2 ++
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index b05b541..8d63294 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -212,7 +212,8 @@ static void shader_arb_load_constants(
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, psi->bumpenvmatconst[i].const_num, data));
deviceImpl->activeContext->pshader_const_dirty[psi->bumpenvmatconst[i].const_num] = 1;
- if(psi->luminanceconst[i].const_num != -1) {
+ if (psi->luminanceconst[i].const_num != WINED3D_CONST_NUM_UNUSED)
+ {
/* WINED3DTSS_BUMPENVLSCALE and WINED3DTSS_BUMPENVLOFFSET are next to each other.
* point gl to the scale, and load 4 floats. x = scale, y = offset, z and w are junk, we
* don't care about them. The pointers are valid for sure because the stateblock is bigger.
@@ -777,7 +778,9 @@ static void pshader_hw_bem(const SHADER_OPCODE_ARG *arg)
int i;
for(i = 0; i < This->numbumpenvmatconsts; i++) {
- if(This->bumpenvmatconst[i].const_num != -1 && This->bumpenvmatconst[i].texunit == sampler_code) {
+ if (This->bumpenvmatconst[i].const_num != WINED3D_CONST_NUM_UNUSED
+ && This->bumpenvmatconst[i].texunit == sampler_code)
+ {
has_bumpmat = TRUE;
break;
}
@@ -1232,13 +1235,17 @@ static void pshader_hw_texbem(const SHADER_OPCODE_ARG *arg)
pshader_get_register_name(arg->shader, dst, reg_coord);
for(i = 0; i < This->numbumpenvmatconsts; i++) {
- if(This->bumpenvmatconst[i].const_num != -1 && reg_dest_code == This->bumpenvmatconst[i].texunit) {
+ if (This->bumpenvmatconst[i].const_num != WINED3D_CONST_NUM_UNUSED
+ && reg_dest_code == This->bumpenvmatconst[i].texunit)
+ {
has_bumpmat = TRUE;
break;
}
}
for(i = 0; i < This->numbumpenvmatconsts; i++) {
- if(This->luminanceconst[i].const_num != -1 && reg_dest_code == This->luminanceconst[i].texunit) {
+ if (This->luminanceconst[i].const_num != WINED3D_CONST_NUM_UNUSED
+ && reg_dest_code == This->luminanceconst[i].texunit)
+ {
has_luminance = TRUE;
break;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b905aea..846a15a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -435,6 +435,8 @@ enum vertexprocessing_mode {
pretransformed
};
+#define WINED3D_CONST_NUM_UNUSED ~0U
+
struct stb_const_desc {
char texunit;
UINT const_num;
More information about the wine-cvs
mailing list