From 42a8041cb84ea55ca4118434ed6b724a593c1109 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 29 Apr 2009 09:55:07 +0200 Subject: [PATCH] wined3d: Handle the sampler type shift in the frontend. --- dlls/wined3d/baseshader.c | 8 ++++++-- dlls/wined3d/wined3d_private_types.h | 19 ++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c index d8035b70817..f9f2f8071a9 100644 --- a/dlls/wined3d/baseshader.c +++ b/dlls/wined3d/baseshader.c @@ -38,6 +38,10 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d); #define WINED3DSP_DCL_USAGEINDEX_SHIFT 16 #define WINED3DSP_DCL_USAGEINDEX_MASK (0xf << WINED3DSP_DCL_USAGEINDEX_SHIFT) +/* DCL sampler type */ +#define WINED3DSP_TEXTURETYPE_SHIFT 27 +#define WINED3DSP_TEXTURETYPE_MASK (0xf << WINED3DSP_TEXTURETYPE_SHIFT) + /* Opcode-related masks */ #define WINED3DSI_OPCODE_MASK 0x0000ffff @@ -269,7 +273,7 @@ static void shader_sm1_read_semantic(const DWORD **ptr, struct wined3d_shader_se semantic->usage = (usage_token & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT; semantic->usage_idx = (usage_token & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT; - semantic->sampler_type = usage_token & WINED3DSP_TEXTURETYPE_MASK; + semantic->sampler_type = (usage_token & WINED3DSP_TEXTURETYPE_MASK) >> WINED3DSP_TEXTURETYPE_SHIFT; shader_parse_dst_param(dst_token, NULL, &semantic->reg); } @@ -824,7 +828,7 @@ static void shader_dump_decl_usage(DWORD decl, DWORD param, DWORD shader_version TRACE("dcl"); if (regtype == WINED3DSPR_SAMPLER) { - DWORD ttype = decl & WINED3DSP_TEXTURETYPE_MASK; + DWORD ttype = (decl & WINED3DSP_TEXTURETYPE_MASK) >> WINED3DSP_TEXTURETYPE_SHIFT; switch (ttype) { case WINED3DSTT_2D: TRACE("_2d"); break; diff --git a/dlls/wined3d/wined3d_private_types.h b/dlls/wined3d/wined3d_private_types.h index 9f62a9ca015..30d6900f0f4 100644 --- a/dlls/wined3d/wined3d_private_types.h +++ b/dlls/wined3d/wined3d_private_types.h @@ -31,18 +31,15 @@ #define WINED3DFMT_FLAG_RENDERTARGET 0x10 #define WINED3DFMT_FLAG_FOURCC 0x20 -/** DCL sampler texture type **/ -#define WINED3DSP_TEXTURETYPE_SHIFT 27 -#define WINED3DSP_TEXTURETYPE_MASK 0x78000000 +typedef enum _WINED3DSAMPLER_TEXTURE_TYPE +{ + WINED3DSTT_UNKNOWN = 0, + WINED3DSTT_1D = 1, + WINED3DSTT_2D = 2, + WINED3DSTT_CUBE = 3, + WINED3DSTT_VOLUME = 4, -typedef enum _WINED3DSAMPLER_TEXTURE_TYPE { - WINED3DSTT_UNKNOWN = 0 << WINED3DSP_TEXTURETYPE_SHIFT, - WINED3DSTT_1D = 1 << WINED3DSP_TEXTURETYPE_SHIFT, - WINED3DSTT_2D = 2 << WINED3DSP_TEXTURETYPE_SHIFT, - WINED3DSTT_CUBE = 3 << WINED3DSP_TEXTURETYPE_SHIFT, - WINED3DSTT_VOLUME = 4 << WINED3DSP_TEXTURETYPE_SHIFT, - - WINED3DSTT_FORCE_DWORD = 0x7FFFFFFF + WINED3DSTT_FORCE_DWORD = 0x7FFFFFFF } WINED3DSAMPLER_TEXTURE_TYPE; /** Register types **/