ReactOS 0.4.15-dev-8219-ge8b88cf
shader_sm1.c File Reference
#include "config.h"
#include "wine/port.h"
#include "wined3d_private.h"
Include dependency graph for shader_sm1.c:

Go to the source code of this file.

Classes

struct  wined3d_sm1_opcode_info
 
struct  wined3d_sm1_data
 

Macros

#define WINED3D_SM1_DCL_USAGE_SHIFT   0
 
#define WINED3D_SM1_DCL_USAGE_MASK   (0xfu << WINED3D_SM1_DCL_USAGE_SHIFT)
 
#define WINED3D_SM1_DCL_USAGE_INDEX_SHIFT   16
 
#define WINED3D_SM1_DCL_USAGE_INDEX_MASK   (0xfu << WINED3D_SM1_DCL_USAGE_INDEX_SHIFT)
 
#define WINED3D_SM1_RESOURCE_TYPE_SHIFT   27
 
#define WINED3D_SM1_RESOURCE_TYPE_MASK   (0xfu << WINED3D_SM1_RESOURCE_TYPE_SHIFT)
 
#define WINED3D_SM1_OPCODE_MASK   0x0000ffff
 
#define WINED3D_SM1_INSTRUCTION_FLAGS_SHIFT   16
 
#define WINED3D_SM1_INSTRUCTION_FLAGS_MASK   (0xffu << WINED3D_SM1_INSTRUCTION_FLAGS_SHIFT)
 
#define WINED3D_SM1_INSTRUCTION_LENGTH_SHIFT   24
 
#define WINED3D_SM1_INSTRUCTION_LENGTH_MASK   (0xfu << WINED3D_SM1_INSTRUCTION_LENGTH_SHIFT)
 
#define WINED3D_SM1_COISSUE   (0x1u << 30)
 
#define WINED3D_SM1_COMMENT_SIZE_SHIFT   16
 
#define WINED3D_SM1_COMMENT_SIZE_MASK   (0x7fffu << WINED3D_SM1_COMMENT_SIZE_SHIFT)
 
#define WINED3D_SM1_INSTRUCTION_PREDICATED   (0x1u << 28)
 
#define WINED3D_SM1_REGISTER_NUMBER_MASK   0x000007ff
 
#define WINED3D_SM1_REGISTER_TYPE_SHIFT   28
 
#define WINED3D_SM1_REGISTER_TYPE_MASK   (0x7u << WINED3D_SM1_REGISTER_TYPE_SHIFT)
 
#define WINED3D_SM1_REGISTER_TYPE_SHIFT2   8
 
#define WINED3D_SM1_REGISTER_TYPE_MASK2   (0x18u << WINED3D_SM1_REGISTER_TYPE_SHIFT2)
 
#define WINED3D_SM1_ADDRESS_MODE_SHIFT   13
 
#define WINED3D_SM1_ADDRESS_MODE_MASK   (0x1u << WINED3D_SM1_ADDRESS_MODE_SHIFT)
 
#define WINED3D_SM1_DST_MODIFIER_SHIFT   20
 
#define WINED3D_SM1_DST_MODIFIER_MASK   (0xfu << WINED3D_SM1_DST_MODIFIER_SHIFT)
 
#define WINED3D_SM1_DSTSHIFT_SHIFT   24
 
#define WINED3D_SM1_DSTSHIFT_MASK   (0xfu << WINED3D_SM1_DSTSHIFT_SHIFT)
 
#define WINED3D_SM1_WRITEMASK_SHIFT   16
 
#define WINED3D_SM1_WRITEMASK_MASK   (0xfu << WINED3D_SM1_WRITEMASK_SHIFT)
 
#define WINED3D_SM1_SWIZZLE_SHIFT   16
 
#define WINED3D_SM1_SWIZZLE_MASK   (0xffu << WINED3D_SM1_SWIZZLE_SHIFT)
 
#define WINED3D_SM1_SRC_MODIFIER_SHIFT   24
 
#define WINED3D_SM1_SRC_MODIFIER_MASK   (0xfu << WINED3D_SM1_SRC_MODIFIER_SHIFT)
 
#define WINED3D_SM1_END   0x0000ffff
 
#define WINED3D_SM1_VERSION_MAJOR(version)   (((version) >> 8) & 0xff)
 
#define WINED3D_SM1_VERSION_MINOR(version)   (((version) >> 0) & 0xff)
 

Enumerations

enum  wined3d_sm1_address_mode_type { WINED3D_SM1_ADDRESS_MODE_ABSOLUTE = 0u << WINED3D_SM1_ADDRESS_MODE_SHIFT , WINED3D_SM1_ADDRESS_MODE_RELATIVE = 1u << WINED3D_SM1_ADDRESS_MODE_SHIFT }
 
enum  wined3d_sm1_resource_type {
  WINED3D_SM1_RESOURCE_UNKNOWN = 0x0 , WINED3D_SM1_RESOURCE_TEXTURE_1D = 0x1 , WINED3D_SM1_RESOURCE_TEXTURE_2D = 0x2 , WINED3D_SM1_RESOURCE_TEXTURE_CUBE = 0x3 ,
  WINED3D_SM1_RESOURCE_TEXTURE_3D = 0x4
}
 
enum  wined3d_sm1_opcode {
  WINED3D_SM1_OP_NOP = 0x00 , WINED3D_SM1_OP_MOV = 0x01 , WINED3D_SM1_OP_ADD = 0x02 , WINED3D_SM1_OP_SUB = 0x03 ,
  WINED3D_SM1_OP_MAD = 0x04 , WINED3D_SM1_OP_MUL = 0x05 , WINED3D_SM1_OP_RCP = 0x06 , WINED3D_SM1_OP_RSQ = 0x07 ,
  WINED3D_SM1_OP_DP3 = 0x08 , WINED3D_SM1_OP_DP4 = 0x09 , WINED3D_SM1_OP_MIN = 0x0a , WINED3D_SM1_OP_MAX = 0x0b ,
  WINED3D_SM1_OP_SLT = 0x0c , WINED3D_SM1_OP_SGE = 0x0d , WINED3D_SM1_OP_EXP = 0x0e , WINED3D_SM1_OP_LOG = 0x0f ,
  WINED3D_SM1_OP_LIT = 0x10 , WINED3D_SM1_OP_DST = 0x11 , WINED3D_SM1_OP_LRP = 0x12 , WINED3D_SM1_OP_FRC = 0x13 ,
  WINED3D_SM1_OP_M4x4 = 0x14 , WINED3D_SM1_OP_M4x3 = 0x15 , WINED3D_SM1_OP_M3x4 = 0x16 , WINED3D_SM1_OP_M3x3 = 0x17 ,
  WINED3D_SM1_OP_M3x2 = 0x18 , WINED3D_SM1_OP_CALL = 0x19 , WINED3D_SM1_OP_CALLNZ = 0x1a , WINED3D_SM1_OP_LOOP = 0x1b ,
  WINED3D_SM1_OP_RET = 0x1c , WINED3D_SM1_OP_ENDLOOP = 0x1d , WINED3D_SM1_OP_LABEL = 0x1e , WINED3D_SM1_OP_DCL = 0x1f ,
  WINED3D_SM1_OP_POW = 0x20 , WINED3D_SM1_OP_CRS = 0x21 , WINED3D_SM1_OP_SGN = 0x22 , WINED3D_SM1_OP_ABS = 0x23 ,
  WINED3D_SM1_OP_NRM = 0x24 , WINED3D_SM1_OP_SINCOS = 0x25 , WINED3D_SM1_OP_REP = 0x26 , WINED3D_SM1_OP_ENDREP = 0x27 ,
  WINED3D_SM1_OP_IF = 0x28 , WINED3D_SM1_OP_IFC = 0x29 , WINED3D_SM1_OP_ELSE = 0x2a , WINED3D_SM1_OP_ENDIF = 0x2b ,
  WINED3D_SM1_OP_BREAK = 0x2c , WINED3D_SM1_OP_BREAKC = 0x2d , WINED3D_SM1_OP_MOVA = 0x2e , WINED3D_SM1_OP_DEFB = 0x2f ,
  WINED3D_SM1_OP_DEFI = 0x30 , WINED3D_SM1_OP_TEXCOORD = 0x40 , WINED3D_SM1_OP_TEXKILL = 0x41 , WINED3D_SM1_OP_TEX = 0x42 ,
  WINED3D_SM1_OP_TEXBEM = 0x43 , WINED3D_SM1_OP_TEXBEML = 0x44 , WINED3D_SM1_OP_TEXREG2AR = 0x45 , WINED3D_SM1_OP_TEXREG2GB = 0x46 ,
  WINED3D_SM1_OP_TEXM3x2PAD = 0x47 , WINED3D_SM1_OP_TEXM3x2TEX = 0x48 , WINED3D_SM1_OP_TEXM3x3PAD = 0x49 , WINED3D_SM1_OP_TEXM3x3TEX = 0x4a ,
  WINED3D_SM1_OP_TEXM3x3DIFF = 0x4b , WINED3D_SM1_OP_TEXM3x3SPEC = 0x4c , WINED3D_SM1_OP_TEXM3x3VSPEC = 0x4d , WINED3D_SM1_OP_EXPP = 0x4e ,
  WINED3D_SM1_OP_LOGP = 0x4f , WINED3D_SM1_OP_CND = 0x50 , WINED3D_SM1_OP_DEF = 0x51 , WINED3D_SM1_OP_TEXREG2RGB = 0x52 ,
  WINED3D_SM1_OP_TEXDP3TEX = 0x53 , WINED3D_SM1_OP_TEXM3x2DEPTH = 0x54 , WINED3D_SM1_OP_TEXDP3 = 0x55 , WINED3D_SM1_OP_TEXM3x3 = 0x56 ,
  WINED3D_SM1_OP_TEXDEPTH = 0x57 , WINED3D_SM1_OP_CMP = 0x58 , WINED3D_SM1_OP_BEM = 0x59 , WINED3D_SM1_OP_DP2ADD = 0x5a ,
  WINED3D_SM1_OP_DSX = 0x5b , WINED3D_SM1_OP_DSY = 0x5c , WINED3D_SM1_OP_TEXLDD = 0x5d , WINED3D_SM1_OP_SETP = 0x5e ,
  WINED3D_SM1_OP_TEXLDL = 0x5f , WINED3D_SM1_OP_BREAKP = 0x60 , WINED3D_SM1_OP_PHASE = 0xfffd , WINED3D_SM1_OP_COMMENT = 0xfffe ,
  WINED3D_SM1_OP_END = 0Xffff
}
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d_shader)
 
static unsigned int shader_get_param (const struct wined3d_sm1_data *priv, const DWORD *ptr, DWORD *token, DWORD *addr_token)
 
static const struct wined3d_sm1_opcode_infoshader_get_opcode (const struct wined3d_sm1_data *priv, DWORD token)
 
static unsigned int shader_skip_opcode (const struct wined3d_sm1_data *priv, const struct wined3d_sm1_opcode_info *opcode_info, DWORD opcode_token)
 
static void shader_parse_src_param (DWORD param, const struct wined3d_shader_src_param *rel_addr, struct wined3d_shader_src_param *src)
 
static void shader_parse_dst_param (DWORD param, const struct wined3d_shader_src_param *rel_addr, struct wined3d_shader_dst_param *dst)
 
static unsigned int shader_skip_unrecognized (const struct wined3d_sm1_data *priv, const DWORD *ptr)
 
static voidshader_sm1_init (const DWORD *byte_code, size_t byte_code_size, const struct wined3d_shader_signature *output_signature)
 
static void shader_sm1_free (void *data)
 
static void shader_sm1_read_header (void *data, const DWORD **ptr, struct wined3d_shader_version *shader_version)
 
static void shader_sm1_read_src_param (struct wined3d_sm1_data *priv, const DWORD **ptr, struct wined3d_shader_src_param *src_param, struct wined3d_shader_src_param *src_rel_addr)
 
static void shader_sm1_read_dst_param (struct wined3d_sm1_data *priv, const DWORD **ptr, struct wined3d_shader_dst_param *dst_param, struct wined3d_shader_src_param *dst_rel_addr)
 
static void shader_sm1_read_semantic (const DWORD **ptr, struct wined3d_shader_semantic *semantic)
 
static void shader_sm1_read_immconst (const DWORD **ptr, struct wined3d_shader_src_param *src_param, enum wined3d_immconst_type type, enum wined3d_data_type data_type)
 
static void shader_sm1_read_comment (const DWORD **ptr)
 
static void shader_sm1_validate_instruction (struct wined3d_shader_instruction *ins)
 
static void shader_sm1_read_instruction (void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins)
 
static BOOL shader_sm1_is_end (void *data, const DWORD **ptr)
 

Variables

static const struct wined3d_sm1_opcode_info vs_opcode_table []
 
static const struct wined3d_sm1_opcode_info ps_opcode_table []
 
static enum wined3d_shader_resource_type resource_type_table []
 
const struct wined3d_shader_frontend sm1_shader_frontend
 

Macro Definition Documentation

◆ WINED3D_SM1_ADDRESS_MODE_MASK

#define WINED3D_SM1_ADDRESS_MODE_MASK   (0x1u << WINED3D_SM1_ADDRESS_MODE_SHIFT)

Definition at line 69 of file shader_sm1.c.

◆ WINED3D_SM1_ADDRESS_MODE_SHIFT

#define WINED3D_SM1_ADDRESS_MODE_SHIFT   13

Definition at line 68 of file shader_sm1.c.

◆ WINED3D_SM1_COISSUE

#define WINED3D_SM1_COISSUE   (0x1u << 30)

Definition at line 51 of file shader_sm1.c.

◆ WINED3D_SM1_COMMENT_SIZE_MASK

#define WINED3D_SM1_COMMENT_SIZE_MASK   (0x7fffu << WINED3D_SM1_COMMENT_SIZE_SHIFT)

Definition at line 54 of file shader_sm1.c.

◆ WINED3D_SM1_COMMENT_SIZE_SHIFT

#define WINED3D_SM1_COMMENT_SIZE_SHIFT   16

Definition at line 53 of file shader_sm1.c.

◆ WINED3D_SM1_DCL_USAGE_INDEX_MASK

#define WINED3D_SM1_DCL_USAGE_INDEX_MASK   (0xfu << WINED3D_SM1_DCL_USAGE_INDEX_SHIFT)

Definition at line 36 of file shader_sm1.c.

◆ WINED3D_SM1_DCL_USAGE_INDEX_SHIFT

#define WINED3D_SM1_DCL_USAGE_INDEX_SHIFT   16

Definition at line 35 of file shader_sm1.c.

◆ WINED3D_SM1_DCL_USAGE_MASK

#define WINED3D_SM1_DCL_USAGE_MASK   (0xfu << WINED3D_SM1_DCL_USAGE_SHIFT)

Definition at line 34 of file shader_sm1.c.

◆ WINED3D_SM1_DCL_USAGE_SHIFT

#define WINED3D_SM1_DCL_USAGE_SHIFT   0

Definition at line 33 of file shader_sm1.c.

◆ WINED3D_SM1_DST_MODIFIER_MASK

#define WINED3D_SM1_DST_MODIFIER_MASK   (0xfu << WINED3D_SM1_DST_MODIFIER_SHIFT)

Definition at line 73 of file shader_sm1.c.

◆ WINED3D_SM1_DST_MODIFIER_SHIFT

#define WINED3D_SM1_DST_MODIFIER_SHIFT   20

Definition at line 72 of file shader_sm1.c.

◆ WINED3D_SM1_DSTSHIFT_MASK

#define WINED3D_SM1_DSTSHIFT_MASK   (0xfu << WINED3D_SM1_DSTSHIFT_SHIFT)

Definition at line 77 of file shader_sm1.c.

◆ WINED3D_SM1_DSTSHIFT_SHIFT

#define WINED3D_SM1_DSTSHIFT_SHIFT   24

Definition at line 76 of file shader_sm1.c.

◆ WINED3D_SM1_END

#define WINED3D_SM1_END   0x0000ffff

Definition at line 91 of file shader_sm1.c.

◆ WINED3D_SM1_INSTRUCTION_FLAGS_MASK

#define WINED3D_SM1_INSTRUCTION_FLAGS_MASK   (0xffu << WINED3D_SM1_INSTRUCTION_FLAGS_SHIFT)

Definition at line 46 of file shader_sm1.c.

◆ WINED3D_SM1_INSTRUCTION_FLAGS_SHIFT

#define WINED3D_SM1_INSTRUCTION_FLAGS_SHIFT   16

Definition at line 45 of file shader_sm1.c.

◆ WINED3D_SM1_INSTRUCTION_LENGTH_MASK

#define WINED3D_SM1_INSTRUCTION_LENGTH_MASK   (0xfu << WINED3D_SM1_INSTRUCTION_LENGTH_SHIFT)

Definition at line 49 of file shader_sm1.c.

◆ WINED3D_SM1_INSTRUCTION_LENGTH_SHIFT

#define WINED3D_SM1_INSTRUCTION_LENGTH_SHIFT   24

Definition at line 48 of file shader_sm1.c.

◆ WINED3D_SM1_INSTRUCTION_PREDICATED

#define WINED3D_SM1_INSTRUCTION_PREDICATED   (0x1u << 28)

Definition at line 56 of file shader_sm1.c.

◆ WINED3D_SM1_OPCODE_MASK

#define WINED3D_SM1_OPCODE_MASK   0x0000ffff

Definition at line 43 of file shader_sm1.c.

◆ WINED3D_SM1_REGISTER_NUMBER_MASK

#define WINED3D_SM1_REGISTER_NUMBER_MASK   0x000007ff

Definition at line 59 of file shader_sm1.c.

◆ WINED3D_SM1_REGISTER_TYPE_MASK

#define WINED3D_SM1_REGISTER_TYPE_MASK   (0x7u << WINED3D_SM1_REGISTER_TYPE_SHIFT)

Definition at line 63 of file shader_sm1.c.

◆ WINED3D_SM1_REGISTER_TYPE_MASK2

#define WINED3D_SM1_REGISTER_TYPE_MASK2   (0x18u << WINED3D_SM1_REGISTER_TYPE_SHIFT2)

Definition at line 65 of file shader_sm1.c.

◆ WINED3D_SM1_REGISTER_TYPE_SHIFT

#define WINED3D_SM1_REGISTER_TYPE_SHIFT   28

Definition at line 62 of file shader_sm1.c.

◆ WINED3D_SM1_REGISTER_TYPE_SHIFT2

#define WINED3D_SM1_REGISTER_TYPE_SHIFT2   8

Definition at line 64 of file shader_sm1.c.

◆ WINED3D_SM1_RESOURCE_TYPE_MASK

#define WINED3D_SM1_RESOURCE_TYPE_MASK   (0xfu << WINED3D_SM1_RESOURCE_TYPE_SHIFT)

Definition at line 40 of file shader_sm1.c.

◆ WINED3D_SM1_RESOURCE_TYPE_SHIFT

#define WINED3D_SM1_RESOURCE_TYPE_SHIFT   27

Definition at line 39 of file shader_sm1.c.

◆ WINED3D_SM1_SRC_MODIFIER_MASK

#define WINED3D_SM1_SRC_MODIFIER_MASK   (0xfu << WINED3D_SM1_SRC_MODIFIER_SHIFT)

Definition at line 89 of file shader_sm1.c.

◆ WINED3D_SM1_SRC_MODIFIER_SHIFT

#define WINED3D_SM1_SRC_MODIFIER_SHIFT   24

Definition at line 88 of file shader_sm1.c.

◆ WINED3D_SM1_SWIZZLE_MASK

#define WINED3D_SM1_SWIZZLE_MASK   (0xffu << WINED3D_SM1_SWIZZLE_SHIFT)

Definition at line 85 of file shader_sm1.c.

◆ WINED3D_SM1_SWIZZLE_SHIFT

#define WINED3D_SM1_SWIZZLE_SHIFT   16

Definition at line 84 of file shader_sm1.c.

◆ WINED3D_SM1_VERSION_MAJOR

#define WINED3D_SM1_VERSION_MAJOR (   version)    (((version) >> 8) & 0xff)

Definition at line 93 of file shader_sm1.c.

◆ WINED3D_SM1_VERSION_MINOR

#define WINED3D_SM1_VERSION_MINOR (   version)    (((version) >> 0) & 0xff)

Definition at line 94 of file shader_sm1.c.

◆ WINED3D_SM1_WRITEMASK_MASK

#define WINED3D_SM1_WRITEMASK_MASK   (0xfu << WINED3D_SM1_WRITEMASK_SHIFT)

Definition at line 81 of file shader_sm1.c.

◆ WINED3D_SM1_WRITEMASK_SHIFT

#define WINED3D_SM1_WRITEMASK_SHIFT   16

Definition at line 80 of file shader_sm1.c.

Enumeration Type Documentation

◆ wined3d_sm1_address_mode_type

Enumerator
WINED3D_SM1_ADDRESS_MODE_ABSOLUTE 
WINED3D_SM1_ADDRESS_MODE_RELATIVE 

Definition at line 96 of file shader_sm1.c.

97{
100};
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define WINED3D_SM1_ADDRESS_MODE_SHIFT
Definition: shader_sm1.c:68
@ WINED3D_SM1_ADDRESS_MODE_RELATIVE
Definition: shader_sm1.c:99
@ WINED3D_SM1_ADDRESS_MODE_ABSOLUTE
Definition: shader_sm1.c:98

◆ wined3d_sm1_opcode

Enumerator
WINED3D_SM1_OP_NOP 
WINED3D_SM1_OP_MOV 
WINED3D_SM1_OP_ADD 
WINED3D_SM1_OP_SUB 
WINED3D_SM1_OP_MAD 
WINED3D_SM1_OP_MUL 
WINED3D_SM1_OP_RCP 
WINED3D_SM1_OP_RSQ 
WINED3D_SM1_OP_DP3 
WINED3D_SM1_OP_DP4 
WINED3D_SM1_OP_MIN 
WINED3D_SM1_OP_MAX 
WINED3D_SM1_OP_SLT 
WINED3D_SM1_OP_SGE 
WINED3D_SM1_OP_EXP 
WINED3D_SM1_OP_LOG 
WINED3D_SM1_OP_LIT 
WINED3D_SM1_OP_DST 
WINED3D_SM1_OP_LRP 
WINED3D_SM1_OP_FRC 
WINED3D_SM1_OP_M4x4 
WINED3D_SM1_OP_M4x3 
WINED3D_SM1_OP_M3x4 
WINED3D_SM1_OP_M3x3 
WINED3D_SM1_OP_M3x2 
WINED3D_SM1_OP_CALL 
WINED3D_SM1_OP_CALLNZ 
WINED3D_SM1_OP_LOOP 
WINED3D_SM1_OP_RET 
WINED3D_SM1_OP_ENDLOOP 
WINED3D_SM1_OP_LABEL 
WINED3D_SM1_OP_DCL 
WINED3D_SM1_OP_POW 
WINED3D_SM1_OP_CRS 
WINED3D_SM1_OP_SGN 
WINED3D_SM1_OP_ABS 
WINED3D_SM1_OP_NRM 
WINED3D_SM1_OP_SINCOS 
WINED3D_SM1_OP_REP 
WINED3D_SM1_OP_ENDREP 
WINED3D_SM1_OP_IF 
WINED3D_SM1_OP_IFC 
WINED3D_SM1_OP_ELSE 
WINED3D_SM1_OP_ENDIF 
WINED3D_SM1_OP_BREAK 
WINED3D_SM1_OP_BREAKC 
WINED3D_SM1_OP_MOVA 
WINED3D_SM1_OP_DEFB 
WINED3D_SM1_OP_DEFI 
WINED3D_SM1_OP_TEXCOORD 
WINED3D_SM1_OP_TEXKILL 
WINED3D_SM1_OP_TEX 
WINED3D_SM1_OP_TEXBEM 
WINED3D_SM1_OP_TEXBEML 
WINED3D_SM1_OP_TEXREG2AR 
WINED3D_SM1_OP_TEXREG2GB 
WINED3D_SM1_OP_TEXM3x2PAD 
WINED3D_SM1_OP_TEXM3x2TEX 
WINED3D_SM1_OP_TEXM3x3PAD 
WINED3D_SM1_OP_TEXM3x3TEX 
WINED3D_SM1_OP_TEXM3x3DIFF 
WINED3D_SM1_OP_TEXM3x3SPEC 
WINED3D_SM1_OP_TEXM3x3VSPEC 
WINED3D_SM1_OP_EXPP 
WINED3D_SM1_OP_LOGP 
WINED3D_SM1_OP_CND 
WINED3D_SM1_OP_DEF 
WINED3D_SM1_OP_TEXREG2RGB 
WINED3D_SM1_OP_TEXDP3TEX 
WINED3D_SM1_OP_TEXM3x2DEPTH 
WINED3D_SM1_OP_TEXDP3 
WINED3D_SM1_OP_TEXM3x3 
WINED3D_SM1_OP_TEXDEPTH 
WINED3D_SM1_OP_CMP 
WINED3D_SM1_OP_BEM 
WINED3D_SM1_OP_DP2ADD 
WINED3D_SM1_OP_DSX 
WINED3D_SM1_OP_DSY 
WINED3D_SM1_OP_TEXLDD 
WINED3D_SM1_OP_SETP 
WINED3D_SM1_OP_TEXLDL 
WINED3D_SM1_OP_BREAKP 
WINED3D_SM1_OP_PHASE 
WINED3D_SM1_OP_COMMENT 
WINED3D_SM1_OP_END 

Definition at line 111 of file shader_sm1.c.

112{
113 WINED3D_SM1_OP_NOP = 0x00,
114 WINED3D_SM1_OP_MOV = 0x01,
115 WINED3D_SM1_OP_ADD = 0x02,
116 WINED3D_SM1_OP_SUB = 0x03,
117 WINED3D_SM1_OP_MAD = 0x04,
118 WINED3D_SM1_OP_MUL = 0x05,
119 WINED3D_SM1_OP_RCP = 0x06,
120 WINED3D_SM1_OP_RSQ = 0x07,
121 WINED3D_SM1_OP_DP3 = 0x08,
122 WINED3D_SM1_OP_DP4 = 0x09,
123 WINED3D_SM1_OP_MIN = 0x0a,
124 WINED3D_SM1_OP_MAX = 0x0b,
125 WINED3D_SM1_OP_SLT = 0x0c,
126 WINED3D_SM1_OP_SGE = 0x0d,
127 WINED3D_SM1_OP_EXP = 0x0e,
128 WINED3D_SM1_OP_LOG = 0x0f,
129 WINED3D_SM1_OP_LIT = 0x10,
130 WINED3D_SM1_OP_DST = 0x11,
131 WINED3D_SM1_OP_LRP = 0x12,
132 WINED3D_SM1_OP_FRC = 0x13,
133 WINED3D_SM1_OP_M4x4 = 0x14,
134 WINED3D_SM1_OP_M4x3 = 0x15,
135 WINED3D_SM1_OP_M3x4 = 0x16,
136 WINED3D_SM1_OP_M3x3 = 0x17,
137 WINED3D_SM1_OP_M3x2 = 0x18,
138 WINED3D_SM1_OP_CALL = 0x19,
140 WINED3D_SM1_OP_LOOP = 0x1b,
141 WINED3D_SM1_OP_RET = 0x1c,
144 WINED3D_SM1_OP_DCL = 0x1f,
145 WINED3D_SM1_OP_POW = 0x20,
146 WINED3D_SM1_OP_CRS = 0x21,
147 WINED3D_SM1_OP_SGN = 0x22,
148 WINED3D_SM1_OP_ABS = 0x23,
149 WINED3D_SM1_OP_NRM = 0x24,
151 WINED3D_SM1_OP_REP = 0x26,
153 WINED3D_SM1_OP_IF = 0x28,
154 WINED3D_SM1_OP_IFC = 0x29,
155 WINED3D_SM1_OP_ELSE = 0x2a,
159 WINED3D_SM1_OP_MOVA = 0x2e,
160 WINED3D_SM1_OP_DEFB = 0x2f,
161 WINED3D_SM1_OP_DEFI = 0x30,
162
165 WINED3D_SM1_OP_TEX = 0x42,
177 WINED3D_SM1_OP_EXPP = 0x4e,
178 WINED3D_SM1_OP_LOGP = 0x4f,
179 WINED3D_SM1_OP_CND = 0x50,
180 WINED3D_SM1_OP_DEF = 0x51,
187 WINED3D_SM1_OP_CMP = 0x58,
188 WINED3D_SM1_OP_BEM = 0x59,
190 WINED3D_SM1_OP_DSX = 0x5b,
191 WINED3D_SM1_OP_DSY = 0x5c,
193 WINED3D_SM1_OP_SETP = 0x5e,
196
197 WINED3D_SM1_OP_PHASE = 0xfffd,
198 WINED3D_SM1_OP_COMMENT = 0xfffe,
199 WINED3D_SM1_OP_END = 0Xffff,
200};
@ WINED3D_SM1_OP_MOV
Definition: shader_sm1.c:114
@ WINED3D_SM1_OP_SGN
Definition: shader_sm1.c:147
@ WINED3D_SM1_OP_MAD
Definition: shader_sm1.c:117
@ WINED3D_SM1_OP_SINCOS
Definition: shader_sm1.c:150
@ WINED3D_SM1_OP_MAX
Definition: shader_sm1.c:124
@ WINED3D_SM1_OP_BREAKC
Definition: shader_sm1.c:158
@ WINED3D_SM1_OP_TEXDP3TEX
Definition: shader_sm1.c:182
@ WINED3D_SM1_OP_TEXDP3
Definition: shader_sm1.c:184
@ WINED3D_SM1_OP_NOP
Definition: shader_sm1.c:113
@ WINED3D_SM1_OP_ENDLOOP
Definition: shader_sm1.c:142
@ WINED3D_SM1_OP_FRC
Definition: shader_sm1.c:132
@ WINED3D_SM1_OP_LIT
Definition: shader_sm1.c:129
@ WINED3D_SM1_OP_M3x2
Definition: shader_sm1.c:137
@ WINED3D_SM1_OP_SETP
Definition: shader_sm1.c:193
@ WINED3D_SM1_OP_TEXM3x2PAD
Definition: shader_sm1.c:170
@ WINED3D_SM1_OP_TEXDEPTH
Definition: shader_sm1.c:186
@ WINED3D_SM1_OP_TEXM3x3TEX
Definition: shader_sm1.c:173
@ WINED3D_SM1_OP_TEX
Definition: shader_sm1.c:165
@ WINED3D_SM1_OP_DSX
Definition: shader_sm1.c:190
@ WINED3D_SM1_OP_IFC
Definition: shader_sm1.c:154
@ WINED3D_SM1_OP_M4x4
Definition: shader_sm1.c:133
@ WINED3D_SM1_OP_TEXM3x3
Definition: shader_sm1.c:185
@ WINED3D_SM1_OP_MUL
Definition: shader_sm1.c:118
@ WINED3D_SM1_OP_TEXM3x3VSPEC
Definition: shader_sm1.c:176
@ WINED3D_SM1_OP_SLT
Definition: shader_sm1.c:125
@ WINED3D_SM1_OP_MOVA
Definition: shader_sm1.c:159
@ WINED3D_SM1_OP_TEXM3x3SPEC
Definition: shader_sm1.c:175
@ WINED3D_SM1_OP_SGE
Definition: shader_sm1.c:126
@ WINED3D_SM1_OP_PHASE
Definition: shader_sm1.c:197
@ WINED3D_SM1_OP_BREAK
Definition: shader_sm1.c:157
@ WINED3D_SM1_OP_RCP
Definition: shader_sm1.c:119
@ WINED3D_SM1_OP_DEFB
Definition: shader_sm1.c:160
@ WINED3D_SM1_OP_LOGP
Definition: shader_sm1.c:178
@ WINED3D_SM1_OP_TEXCOORD
Definition: shader_sm1.c:163
@ WINED3D_SM1_OP_BEM
Definition: shader_sm1.c:188
@ WINED3D_SM1_OP_LABEL
Definition: shader_sm1.c:143
@ WINED3D_SM1_OP_TEXBEML
Definition: shader_sm1.c:167
@ WINED3D_SM1_OP_END
Definition: shader_sm1.c:199
@ WINED3D_SM1_OP_M3x3
Definition: shader_sm1.c:136
@ WINED3D_SM1_OP_ENDIF
Definition: shader_sm1.c:156
@ WINED3D_SM1_OP_LRP
Definition: shader_sm1.c:131
@ WINED3D_SM1_OP_REP
Definition: shader_sm1.c:151
@ WINED3D_SM1_OP_LOOP
Definition: shader_sm1.c:140
@ WINED3D_SM1_OP_DCL
Definition: shader_sm1.c:144
@ WINED3D_SM1_OP_CND
Definition: shader_sm1.c:179
@ WINED3D_SM1_OP_RET
Definition: shader_sm1.c:141
@ WINED3D_SM1_OP_CMP
Definition: shader_sm1.c:187
@ WINED3D_SM1_OP_LOG
Definition: shader_sm1.c:128
@ WINED3D_SM1_OP_POW
Definition: shader_sm1.c:145
@ WINED3D_SM1_OP_TEXM3x3DIFF
Definition: shader_sm1.c:174
@ WINED3D_SM1_OP_M4x3
Definition: shader_sm1.c:134
@ WINED3D_SM1_OP_CALL
Definition: shader_sm1.c:138
@ WINED3D_SM1_OP_DP4
Definition: shader_sm1.c:122
@ WINED3D_SM1_OP_TEXREG2RGB
Definition: shader_sm1.c:181
@ WINED3D_SM1_OP_EXPP
Definition: shader_sm1.c:177
@ WINED3D_SM1_OP_DSY
Definition: shader_sm1.c:191
@ WINED3D_SM1_OP_NRM
Definition: shader_sm1.c:149
@ WINED3D_SM1_OP_SUB
Definition: shader_sm1.c:116
@ WINED3D_SM1_OP_TEXM3x2TEX
Definition: shader_sm1.c:171
@ WINED3D_SM1_OP_DEFI
Definition: shader_sm1.c:161
@ WINED3D_SM1_OP_IF
Definition: shader_sm1.c:153
@ WINED3D_SM1_OP_DP3
Definition: shader_sm1.c:121
@ WINED3D_SM1_OP_RSQ
Definition: shader_sm1.c:120
@ WINED3D_SM1_OP_DP2ADD
Definition: shader_sm1.c:189
@ WINED3D_SM1_OP_EXP
Definition: shader_sm1.c:127
@ WINED3D_SM1_OP_ABS
Definition: shader_sm1.c:148
@ WINED3D_SM1_OP_ADD
Definition: shader_sm1.c:115
@ WINED3D_SM1_OP_TEXLDD
Definition: shader_sm1.c:192
@ WINED3D_SM1_OP_CRS
Definition: shader_sm1.c:146
@ WINED3D_SM1_OP_ENDREP
Definition: shader_sm1.c:152
@ WINED3D_SM1_OP_DST
Definition: shader_sm1.c:130
@ WINED3D_SM1_OP_MIN
Definition: shader_sm1.c:123
@ WINED3D_SM1_OP_ELSE
Definition: shader_sm1.c:155
@ WINED3D_SM1_OP_COMMENT
Definition: shader_sm1.c:198
@ WINED3D_SM1_OP_TEXBEM
Definition: shader_sm1.c:166
@ WINED3D_SM1_OP_TEXM3x2DEPTH
Definition: shader_sm1.c:183
@ WINED3D_SM1_OP_BREAKP
Definition: shader_sm1.c:195
@ WINED3D_SM1_OP_TEXLDL
Definition: shader_sm1.c:194
@ WINED3D_SM1_OP_CALLNZ
Definition: shader_sm1.c:139
@ WINED3D_SM1_OP_DEF
Definition: shader_sm1.c:180
@ WINED3D_SM1_OP_TEXREG2GB
Definition: shader_sm1.c:169
@ WINED3D_SM1_OP_TEXKILL
Definition: shader_sm1.c:164
@ WINED3D_SM1_OP_TEXM3x3PAD
Definition: shader_sm1.c:172
@ WINED3D_SM1_OP_TEXREG2AR
Definition: shader_sm1.c:168
@ WINED3D_SM1_OP_M3x4
Definition: shader_sm1.c:135

◆ wined3d_sm1_resource_type

Enumerator
WINED3D_SM1_RESOURCE_UNKNOWN 
WINED3D_SM1_RESOURCE_TEXTURE_1D 
WINED3D_SM1_RESOURCE_TEXTURE_2D 
WINED3D_SM1_RESOURCE_TEXTURE_CUBE 
WINED3D_SM1_RESOURCE_TEXTURE_3D 

Definition at line 102 of file shader_sm1.c.

103{
109};
@ WINED3D_SM1_RESOURCE_TEXTURE_1D
Definition: shader_sm1.c:105
@ WINED3D_SM1_RESOURCE_UNKNOWN
Definition: shader_sm1.c:104
@ WINED3D_SM1_RESOURCE_TEXTURE_CUBE
Definition: shader_sm1.c:107
@ WINED3D_SM1_RESOURCE_TEXTURE_3D
Definition: shader_sm1.c:108
@ WINED3D_SM1_RESOURCE_TEXTURE_2D
Definition: shader_sm1.c:106

Function Documentation

◆ shader_get_opcode()

static const struct wined3d_sm1_opcode_info * shader_get_opcode ( const struct wined3d_sm1_data priv,
DWORD  token 
)
static

Definition at line 432 of file shader_sm1.c.

433{
434 DWORD shader_version = WINED3D_SHADER_VERSION(priv->shader_version.major, priv->shader_version.minor);
436 unsigned int i = 0;
437
439 {
441 && shader_version >= opcode_table[i].min_version
442 && (!opcode_table[i].max_version || shader_version <= opcode_table[i].max_version))
443 {
444 return &opcode_table[i];
445 }
446 ++i;
447 }
448
449 FIXME("Unsupported opcode %#x, token 0x%08x, shader version %#x.\n",
450 token & WINED3D_SM1_OPCODE_MASK, token, shader_version);
451
452 return NULL;
453}
#define FIXME(fmt,...)
Definition: debug.h:114
#define NULL
Definition: types.h:112
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
unsigned min_version
Definition: lex.c:39
#define WINED3D_SM1_OPCODE_MASK
Definition: shader_sm1.c:43
static const struct wined3d_sm4_opcode_info opcode_table[]
Definition: shader_sm4.c:883
struct wined3d_shader_version shader_version
Definition: shader_sm1.c:214
const struct wined3d_sm1_opcode_info * opcode_table
Definition: shader_sm1.c:215
enum wined3d_sm1_opcode opcode
Definition: shader_sm1.c:204
enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx
Definition: shader_sm1.c:207
@ WINED3DSIH_TABLE_SIZE
#define WINED3D_SHADER_VERSION(major, minor)

Referenced by shader_sm1_read_instruction().

◆ shader_get_param()

static unsigned int shader_get_param ( const struct wined3d_sm1_data priv,
const DWORD ptr,
DWORD token,
DWORD addr_token 
)
static

Definition at line 402 of file shader_sm1.c.

404{
405 unsigned int count = 1;
406
407 *token = *ptr;
408
409 /* PS >= 3.0 have relative addressing (with token)
410 * VS >= 2.0 have relative addressing (with token)
411 * VS >= 1.0 < 2.0 have relative addressing (without token)
412 * The version check below should work in general */
414 {
415 if (priv->shader_version.major < 2)
416 {
417 *addr_token = (1u << 31)
421 }
422 else
423 {
424 *addr_token = *(ptr + 1);
425 ++count;
426 }
427 }
428
429 return count;
430}
GLuint GLuint GLsizei count
Definition: gl.h:1545
static PVOID ptr
Definition: dispmode.c:27
#define WINED3D_SM1_REGISTER_TYPE_SHIFT2
Definition: shader_sm1.c:64
#define WINED3D_SM1_REGISTER_TYPE_SHIFT
Definition: shader_sm1.c:62
#define WINED3D_SM1_REGISTER_TYPE_MASK2
Definition: shader_sm1.c:65
#define WINED3D_SM1_REGISTER_TYPE_MASK
Definition: shader_sm1.c:63
#define WINED3D_SM1_SWIZZLE_SHIFT
Definition: shader_sm1.c:84
@ WINED3DSPR_ADDR
#define WINED3DSP_NOSWIZZLE

Referenced by shader_skip_unrecognized(), shader_sm1_read_dst_param(), and shader_sm1_read_src_param().

◆ shader_parse_dst_param()

static void shader_parse_dst_param ( DWORD  param,
const struct wined3d_shader_src_param rel_addr,
struct wined3d_shader_dst_param dst 
)
static

Definition at line 480 of file shader_sm1.c.

482{
485 dst->reg.data_type = WINED3D_DATA_FLOAT;
486 dst->reg.idx[0].offset = param & WINED3D_SM1_REGISTER_NUMBER_MASK;
487 dst->reg.idx[0].rel_addr = rel_addr;
488 dst->reg.idx[1].offset = ~0U;
489 dst->reg.idx[1].rel_addr = NULL;
493}
#define U(x)
Definition: wordpad.c:45
GLenum GLenum dst
Definition: glext.h:6340
GLfloat param
Definition: glext.h:5796
#define WINED3D_SM1_DST_MODIFIER_MASK
Definition: shader_sm1.c:73
#define WINED3D_SM1_WRITEMASK_MASK
Definition: shader_sm1.c:81
#define WINED3D_SM1_DST_MODIFIER_SHIFT
Definition: shader_sm1.c:72
#define WINED3D_SM1_WRITEMASK_SHIFT
Definition: shader_sm1.c:80
#define WINED3D_SM1_DSTSHIFT_MASK
Definition: shader_sm1.c:77
#define WINED3D_SM1_REGISTER_NUMBER_MASK
Definition: shader_sm1.c:59
#define WINED3D_SM1_DSTSHIFT_SHIFT
Definition: shader_sm1.c:76
struct wined3d_shader_register reg
@ WINED3D_DATA_FLOAT

Referenced by shader_skip_unrecognized(), shader_sm1_read_dst_param(), and shader_sm1_read_semantic().

◆ shader_parse_src_param()

static void shader_parse_src_param ( DWORD  param,
const struct wined3d_shader_src_param rel_addr,
struct wined3d_shader_src_param src 
)
static

Definition at line 466 of file shader_sm1.c.

468{
471 src->reg.data_type = WINED3D_DATA_FLOAT;
472 src->reg.idx[0].offset = param & WINED3D_SM1_REGISTER_NUMBER_MASK;
473 src->reg.idx[0].rel_addr = rel_addr;
474 src->reg.idx[1].offset = ~0U;
475 src->reg.idx[1].rel_addr = NULL;
478}
GLenum src
Definition: glext.h:6340
#define WINED3D_SM1_SRC_MODIFIER_SHIFT
Definition: shader_sm1.c:88
#define WINED3D_SM1_SRC_MODIFIER_MASK
Definition: shader_sm1.c:89
#define WINED3D_SM1_SWIZZLE_MASK
Definition: shader_sm1.c:85

Referenced by shader_skip_unrecognized(), shader_sm1_read_dst_param(), and shader_sm1_read_src_param().

◆ shader_skip_opcode()

static unsigned int shader_skip_opcode ( const struct wined3d_sm1_data priv,
const struct wined3d_sm1_opcode_info opcode_info,
DWORD  opcode_token 
)
static

Definition at line 456 of file shader_sm1.c.

458{
459 unsigned int length;
460 /* Shaders >= 2.0 may contain address tokens, but fortunately they
461 * have a useful length mask - use it here. Shaders 1.0 contain no such tokens */
463 return (priv->shader_version.major >= 2) ? length : opcode_info->param_count;
464}
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define WINED3D_SM1_INSTRUCTION_LENGTH_SHIFT
Definition: shader_sm1.c:48
#define WINED3D_SM1_INSTRUCTION_LENGTH_MASK
Definition: shader_sm1.c:49
unsigned int param_count
Definition: shader_sm1.c:206

Referenced by shader_sm1_read_instruction().

◆ shader_skip_unrecognized()

static unsigned int shader_skip_unrecognized ( const struct wined3d_sm1_data priv,
const DWORD ptr 
)
static

Definition at line 501 of file shader_sm1.c.

502{
503 unsigned int tokens_read = 0, i = 0;
504
505 /* TODO: Think of a good name for 0x80000000 and replace it with a constant */
506 while (*ptr & 0x80000000)
507 {
508 DWORD token, addr_token = 0;
509 struct wined3d_shader_src_param rel_addr;
510
511 tokens_read += shader_get_param(priv, ptr, &token, &addr_token);
512 ptr += tokens_read;
513
514 FIXME("Unrecognized opcode param: token=0x%08x addr_token=0x%08x.\n", token, addr_token);
515
517 shader_parse_src_param(addr_token, NULL, &rel_addr);
518
519 if (!i)
520 {
522
524 }
525 else
526 {
528
530 }
531 ++i;
532 }
533 return tokens_read;
534}
static void shader_parse_src_param(DWORD param, const struct wined3d_shader_src_param *rel_addr, struct wined3d_shader_src_param *src)
Definition: shader_sm1.c:466
static unsigned int shader_get_param(const struct wined3d_sm1_data *priv, const DWORD *ptr, DWORD *token, DWORD *addr_token)
Definition: shader_sm1.c:402
static void shader_parse_dst_param(DWORD param, const struct wined3d_shader_src_param *rel_addr, struct wined3d_shader_dst_param *dst)
Definition: shader_sm1.c:480

Referenced by shader_sm1_read_instruction().

◆ shader_sm1_free()

static void shader_sm1_free ( void data)
static

Definition at line 583 of file shader_sm1.c.

584{
586}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ shader_sm1_init()

static void * shader_sm1_init ( const DWORD byte_code,
size_t  byte_code_size,
const struct wined3d_shader_signature output_signature 
)
static

Definition at line 536 of file shader_sm1.c.

538{
539 struct wined3d_sm1_data *priv;
541
542 TRACE("Version: 0x%08x.\n", *byte_code);
543
544 major = WINED3D_SM1_VERSION_MAJOR(*byte_code);
545 minor = WINED3D_SM1_VERSION_MINOR(*byte_code);
547 {
548 WARN("Invalid shader version %u.%u (%#x).\n", major, minor, *byte_code);
549 return NULL;
550 }
551
552 if (!(priv = heap_alloc(sizeof(*priv))))
553 return NULL;
554
555 if (output_signature->element_count)
556 FIXME("SM 1-3 shader shouldn't have output signatures.\n");
557
558 switch (*byte_code >> 16)
559 {
560 case WINED3D_SM1_VS:
563 break;
564
565 case WINED3D_SM1_PS:
568 break;
569
570 default:
571 FIXME("Unrecognized shader type %#x.\n", *byte_code >> 16);
572 heap_free(priv);
573 return NULL;
574 }
575 priv->shader_version.major = WINED3D_SM1_VERSION_MAJOR(*byte_code);
576 priv->shader_version.minor = WINED3D_SM1_VERSION_MINOR(*byte_code);
577
578 priv->start = &byte_code[1];
579
580 return priv;
581}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
#define WARN(fmt,...)
Definition: debug.h:115
#define minor(rdev)
Definition: propsheet.cpp:929
#define major(rdev)
Definition: propsheet.cpp:928
static const struct wined3d_sm1_opcode_info ps_opcode_table[]
Definition: shader_sm1.c:295
#define WINED3D_SM1_VERSION_MINOR(version)
Definition: shader_sm1.c:94
static const struct wined3d_sm1_opcode_info vs_opcode_table[]
Definition: shader_sm1.c:227
#define WINED3D_SM1_VERSION_MAJOR(version)
Definition: shader_sm1.c:93
#define TRACE(s)
Definition: solgame.cpp:4
const DWORD * start
Definition: shader_sm1.c:216
#define WINED3D_SM1_VS
#define WINED3D_SM1_PS
@ WINED3D_SHADER_TYPE_PIXEL
@ WINED3D_SHADER_TYPE_VERTEX
unsigned char BYTE
Definition: xxhash.c:193

◆ shader_sm1_is_end()

static BOOL shader_sm1_is_end ( void data,
const DWORD **  ptr 
)
static

Definition at line 794 of file shader_sm1.c.

795{
797
798 if (**ptr == WINED3D_SM1_END)
799 {
800 ++(*ptr);
801 return TRUE;
802 }
803
804 return FALSE;
805}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static void shader_sm1_read_comment(const DWORD **ptr)
Definition: shader_sm1.c:670
#define WINED3D_SM1_END
Definition: shader_sm1.c:91

◆ shader_sm1_read_comment()

static void shader_sm1_read_comment ( const DWORD **  ptr)
static

Definition at line 670 of file shader_sm1.c.

671{
672 DWORD token = **ptr;
673 const char *comment;
674 UINT size;
675
677 {
679 comment = (const char *)++(*ptr);
680 *ptr += size;
681
682 if (size > 1 && *(const DWORD *)comment == WINEMAKEFOURCC('T', 'E', 'X', 'T'))
683 {
684 const char *end = comment + size * sizeof(token);
685 const char *p = comment + sizeof(token);
686 const char *line = p;
687
688 TRACE("// TEXT\n");
689 while (p != end)
690 {
691 if (*p == '\n')
692 {
693 UINT len = p - line;
694 if (len && *(p - 1) == '\r') --len;
695 TRACE("// %s\n", debugstr_an(line, len));
696 line = ++p;
697 }
698 else ++p;
699 }
700 if (line != p)
701 TRACE("// %s\n", debugstr_an(line, p - line));
702 }
703 else if (size)
704 TRACE("// %s\n", debugstr_an(comment, size * sizeof(token)));
705 else
706 break;
707
708 token = **ptr;
709 }
710}
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
GLuint GLuint end
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
#define comment(fmt, arg1)
Definition: rebar.c:820
unsigned int UINT
Definition: ndis.h:50
#define WINED3D_SM1_COMMENT_SIZE_MASK
Definition: shader_sm1.c:54
#define WINED3D_SM1_COMMENT_SIZE_SHIFT
Definition: shader_sm1.c:53
Definition: parser.c:49
#define WINEMAKEFOURCC(ch0, ch1, ch2, ch3)
Definition: wined3d.h:101

Referenced by shader_sm1_is_end(), and shader_sm1_read_instruction().

◆ shader_sm1_read_dst_param()

static void shader_sm1_read_dst_param ( struct wined3d_sm1_data priv,
const DWORD **  ptr,
struct wined3d_shader_dst_param dst_param,
struct wined3d_shader_src_param dst_rel_addr 
)
static

Definition at line 613 of file shader_sm1.c.

615{
616 DWORD token, addr_token;
617
618 *ptr += shader_get_param(priv, *ptr, &token, &addr_token);
620 {
621 shader_parse_src_param(addr_token, NULL, dst_rel_addr);
622 shader_parse_dst_param(token, dst_rel_addr, dst_param);
623 }
624 else
625 {
626 shader_parse_dst_param(token, NULL, dst_param);
627 }
628}

Referenced by shader_sm1_read_instruction().

◆ shader_sm1_read_header()

static void shader_sm1_read_header ( void data,
const DWORD **  ptr,
struct wined3d_shader_version shader_version 
)
static

Definition at line 588 of file shader_sm1.c.

589{
590 struct wined3d_sm1_data *priv = data;
591
592 *ptr = priv->start;
594}

◆ shader_sm1_read_immconst()

static void shader_sm1_read_immconst ( const DWORD **  ptr,
struct wined3d_shader_src_param src_param,
enum wined3d_immconst_type  type,
enum wined3d_data_type  data_type 
)
static

Definition at line 652 of file shader_sm1.c.

654{
655 unsigned int count = type == WINED3D_IMMCONST_VEC4 ? 4 : 1;
656 src_param->reg.type = WINED3DSPR_IMMCONST;
657 src_param->reg.data_type = data_type;
658 src_param->reg.idx[0].offset = ~0U;
659 src_param->reg.idx[0].rel_addr = NULL;
660 src_param->reg.idx[1].offset = ~0U;
661 src_param->reg.idx[1].rel_addr = NULL;
662 src_param->reg.immconst_type = type;
663 memcpy(src_param->reg.u.immconst_data, *ptr, count * sizeof(DWORD));
664 src_param->swizzle = WINED3DSP_NOSWIZZLE;
665 src_param->modifiers = 0;
666
667 *ptr += count;
668}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
enum wined3d_shader_src_modifier modifiers
@ WINED3DSPR_IMMCONST
@ WINED3D_IMMCONST_VEC4

Referenced by shader_sm1_read_instruction().

◆ shader_sm1_read_instruction()

static void shader_sm1_read_instruction ( void data,
const DWORD **  ptr,
struct wined3d_shader_instruction ins 
)
static

Definition at line 725 of file shader_sm1.c.

726{
727 const struct wined3d_sm1_opcode_info *opcode_info;
728 struct wined3d_sm1_data *priv = data;
729 DWORD opcode_token;
730 unsigned int i;
731 const DWORD *p;
732
734
735 opcode_token = *(*ptr)++;
736 if (!(opcode_info = shader_get_opcode(priv, opcode_token)))
737 {
738 FIXME("Unrecognized opcode: token=0x%08x.\n", opcode_token);
740 *ptr += shader_skip_unrecognized(priv, *ptr);
741 return;
742 }
743
744 ins->handler_idx = opcode_info->handler_idx;
746 ins->coissue = opcode_token & WINED3D_SM1_COISSUE;
747 ins->predicate = opcode_token & WINED3D_SM1_INSTRUCTION_PREDICATED ? &priv->pred_param : NULL;
748 ins->dst_count = opcode_info->dst_count ? 1 : 0;
749 ins->dst = &priv->dst_param;
750 ins->src_count = opcode_info->param_count - opcode_info->dst_count;
751 ins->src = priv->src_param;
752 memset(&ins->texel_offset, 0, sizeof(ins->texel_offset));
753
754 p = *ptr;
755 *ptr += shader_skip_opcode(priv, opcode_info, opcode_token);
756
757 if (ins->handler_idx == WINED3DSIH_DCL)
758 {
760 }
761 else if (ins->handler_idx == WINED3DSIH_DEF)
762 {
763 shader_sm1_read_dst_param(priv, &p, &priv->dst_param, &priv->dst_rel_addr);
765 }
766 else if (ins->handler_idx == WINED3DSIH_DEFB)
767 {
768 shader_sm1_read_dst_param(priv, &p, &priv->dst_param, &priv->dst_rel_addr);
770 }
771 else if (ins->handler_idx == WINED3DSIH_DEFI)
772 {
773 shader_sm1_read_dst_param(priv, &p, &priv->dst_param, &priv->dst_rel_addr);
775 }
776 else
777 {
778 /* Destination token */
779 if (ins->dst_count)
780 shader_sm1_read_dst_param(priv, &p, &priv->dst_param, &priv->dst_rel_addr);
781
782 /* Predication token */
783 if (ins->predicate)
784 shader_sm1_read_src_param(priv, &p, &priv->pred_param, &priv->pred_rel_addr);
785
786 /* Other source tokens */
787 for (i = 0; i < ins->src_count; ++i)
788 shader_sm1_read_src_param(priv, &p, &priv->src_param[i], &priv->src_rel_addr[i]);
789 }
790
792}
#define memset(x, y, z)
Definition: compat.h:39
#define WINED3D_SM1_INSTRUCTION_FLAGS_MASK
Definition: shader_sm1.c:46
static void shader_sm1_read_immconst(const DWORD **ptr, struct wined3d_shader_src_param *src_param, enum wined3d_immconst_type type, enum wined3d_data_type data_type)
Definition: shader_sm1.c:652
#define WINED3D_SM1_INSTRUCTION_FLAGS_SHIFT
Definition: shader_sm1.c:45
static const struct wined3d_sm1_opcode_info * shader_get_opcode(const struct wined3d_sm1_data *priv, DWORD token)
Definition: shader_sm1.c:432
static void shader_sm1_read_dst_param(struct wined3d_sm1_data *priv, const DWORD **ptr, struct wined3d_shader_dst_param *dst_param, struct wined3d_shader_src_param *dst_rel_addr)
Definition: shader_sm1.c:613
static unsigned int shader_skip_unrecognized(const struct wined3d_sm1_data *priv, const DWORD *ptr)
Definition: shader_sm1.c:501
static void shader_sm1_validate_instruction(struct wined3d_shader_instruction *ins)
Definition: shader_sm1.c:712
static unsigned int shader_skip_opcode(const struct wined3d_sm1_data *priv, const struct wined3d_sm1_opcode_info *opcode_info, DWORD opcode_token)
Definition: shader_sm1.c:456
#define WINED3D_SM1_COISSUE
Definition: shader_sm1.c:51
static void shader_sm1_read_src_param(struct wined3d_sm1_data *priv, const DWORD **ptr, struct wined3d_shader_src_param *src_param, struct wined3d_shader_src_param *src_rel_addr)
Definition: shader_sm1.c:596
#define WINED3D_SM1_INSTRUCTION_PREDICATED
Definition: shader_sm1.c:56
static void shader_sm1_read_semantic(const DWORD **ptr, struct wined3d_shader_semantic *semantic)
Definition: shader_sm1.c:630
const struct wined3d_shader_src_param * src
struct wined3d_shader_semantic semantic
const struct wined3d_shader_dst_param * dst
union wined3d_shader_instruction::@284 declaration
const struct wined3d_shader_src_param * predicate
enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx
struct wined3d_shader_texel_offset texel_offset
struct wined3d_shader_src_param pred_rel_addr
Definition: shader_sm1.c:219
struct wined3d_shader_dst_param dst_param
Definition: shader_sm1.c:223
struct wined3d_shader_src_param src_rel_addr[4]
Definition: shader_sm1.c:218
struct wined3d_shader_src_param dst_rel_addr
Definition: shader_sm1.c:220
struct wined3d_shader_src_param src_param[4]
Definition: shader_sm1.c:221
struct wined3d_shader_src_param pred_param
Definition: shader_sm1.c:222
unsigned int dst_count
Definition: shader_sm1.c:205
@ WINED3D_DATA_UINT
@ WINED3D_DATA_INT
@ WINED3DSIH_DEFI
@ WINED3DSIH_DEFB
@ WINED3DSIH_DCL
@ WINED3DSIH_DEF
@ WINED3D_IMMCONST_SCALAR

◆ shader_sm1_read_semantic()

static void shader_sm1_read_semantic ( const DWORD **  ptr,
struct wined3d_shader_semantic semantic 
)
static

Definition at line 630 of file shader_sm1.c.

631{
632 enum wined3d_sm1_resource_type resource_type;
633 DWORD usage_token = *(*ptr)++;
634 DWORD dst_token = *(*ptr)++;
635
636 semantic->usage = (usage_token & WINED3D_SM1_DCL_USAGE_MASK) >> WINED3D_SM1_DCL_USAGE_SHIFT;
638 resource_type = (usage_token & WINED3D_SM1_RESOURCE_TYPE_MASK) >> WINED3D_SM1_RESOURCE_TYPE_SHIFT;
639 if (resource_type >= ARRAY_SIZE(resource_type_table))
640 {
641 FIXME("Unhandled resource type %#x.\n", resource_type);
643 }
644 else
645 {
646 semantic->resource_type = resource_type_table[resource_type];
647 }
649 shader_parse_dst_param(dst_token, NULL, &semantic->reg);
650}
#define ARRAY_SIZE(A)
Definition: main.h:33
#define WINED3D_SM1_RESOURCE_TYPE_MASK
Definition: shader_sm1.c:40
#define WINED3D_SM1_DCL_USAGE_SHIFT
Definition: shader_sm1.c:33
#define WINED3D_SM1_RESOURCE_TYPE_SHIFT
Definition: shader_sm1.c:39
wined3d_sm1_resource_type
Definition: shader_sm1.c:103
#define WINED3D_SM1_DCL_USAGE_MASK
Definition: shader_sm1.c:34
#define WINED3D_SM1_DCL_USAGE_INDEX_SHIFT
Definition: shader_sm1.c:35
#define WINED3D_SM1_DCL_USAGE_INDEX_MASK
Definition: shader_sm1.c:36
static enum wined3d_shader_resource_type resource_type_table[]
Definition: shader_sm1.c:390
struct wined3d_shader_dst_param reg
enum wined3d_decl_usage usage
enum wined3d_data_type resource_data_type
enum wined3d_shader_resource_type resource_type
@ WINED3D_SHADER_RESOURCE_NONE

Referenced by shader_sm1_read_instruction().

◆ shader_sm1_read_src_param()

static void shader_sm1_read_src_param ( struct wined3d_sm1_data priv,
const DWORD **  ptr,
struct wined3d_shader_src_param src_param,
struct wined3d_shader_src_param src_rel_addr 
)
static

Definition at line 596 of file shader_sm1.c.

598{
599 DWORD token, addr_token;
600
601 *ptr += shader_get_param(priv, *ptr, &token, &addr_token);
603 {
604 shader_parse_src_param(addr_token, NULL, src_rel_addr);
605 shader_parse_src_param(token, src_rel_addr, src_param);
606 }
607 else
608 {
609 shader_parse_src_param(token, NULL, src_param);
610 }
611}

Referenced by shader_sm1_read_instruction().

◆ shader_sm1_validate_instruction()

static void shader_sm1_validate_instruction ( struct wined3d_shader_instruction ins)
static

Definition at line 712 of file shader_sm1.c.

713{
715 {
716 if (ins->flags)
717 {
718 FIXME("Ignoring unexpected instruction flags %#x for %s.\n",
720 ins->flags = 0;
721 }
722 }
723}
const char * debug_d3dshaderinstructionhandler(enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx)
Definition: shader.c:334
@ WINED3DSIH_IF
@ WINED3DSIH_BREAKP

Referenced by shader_sm1_read_instruction().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d_shader  )

Variable Documentation

◆ ps_opcode_table

const struct wined3d_sm1_opcode_info ps_opcode_table[]
static

Definition at line 295 of file shader_sm1.c.

Referenced by shader_sm1_init().

◆ resource_type_table

◆ sm1_shader_frontend

const struct wined3d_shader_frontend sm1_shader_frontend
Initial value:
=
{
}
static void shader_sm1_free(void *data)
Definition: shader_sm1.c:583
static void * shader_sm1_init(const DWORD *byte_code, size_t byte_code_size, const struct wined3d_shader_signature *output_signature)
Definition: shader_sm1.c:536
static BOOL shader_sm1_is_end(void *data, const DWORD **ptr)
Definition: shader_sm1.c:794
static void shader_sm1_read_instruction(void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins)
Definition: shader_sm1.c:725
static void shader_sm1_read_header(void *data, const DWORD **ptr, struct wined3d_shader_version *shader_version)
Definition: shader_sm1.c:588

Definition at line 807 of file shader_sm1.c.

Referenced by shader_select_frontend().

◆ vs_opcode_table

const struct wined3d_sm1_opcode_info vs_opcode_table[]
static

Definition at line 227 of file shader_sm1.c.

Referenced by shader_sm1_init().