wined3d: Const correctness fixes for arb_program_shader.c.
This commit is contained in:
parent
cfb3bea895
commit
d8f6e63541
|
@ -66,8 +66,9 @@ struct shader_arb_priv {
|
||||||
* @target_type should be either GL_VERTEX_PROGRAM_ARB (for vertex shaders)
|
* @target_type should be either GL_VERTEX_PROGRAM_ARB (for vertex shaders)
|
||||||
* or GL_FRAGMENT_PROGRAM_ARB (for pixel shaders)
|
* or GL_FRAGMENT_PROGRAM_ARB (for pixel shaders)
|
||||||
*/
|
*/
|
||||||
static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl* This, WineD3D_GL_Info *gl_info, GLuint target_type,
|
static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl* This, const WineD3D_GL_Info *gl_info,
|
||||||
unsigned int max_constants, float* constants, char *dirty_consts) {
|
GLuint target_type, unsigned int max_constants, const float *constants, char *dirty_consts)
|
||||||
|
{
|
||||||
local_constant* lconst;
|
local_constant* lconst;
|
||||||
DWORD i, j;
|
DWORD i, j;
|
||||||
unsigned int ret;
|
unsigned int ret;
|
||||||
|
@ -173,7 +174,7 @@ static void shader_arb_load_constants(
|
||||||
|
|
||||||
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) device;
|
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) device;
|
||||||
IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock;
|
IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock;
|
||||||
WineD3D_GL_Info *gl_info = &deviceImpl->adapter->gl_info;
|
const WineD3D_GL_Info *gl_info = &deviceImpl->adapter->gl_info;
|
||||||
unsigned char i;
|
unsigned char i;
|
||||||
|
|
||||||
if (useVertexShader) {
|
if (useVertexShader) {
|
||||||
|
@ -205,7 +206,7 @@ static void shader_arb_load_constants(
|
||||||
for(i = 0; i < psi->numbumpenvmatconsts; i++) {
|
for(i = 0; i < psi->numbumpenvmatconsts; i++) {
|
||||||
/* The state manager takes care that this function is always called if the bump env matrix changes
|
/* The state manager takes care that this function is always called if the bump env matrix changes
|
||||||
*/
|
*/
|
||||||
float *data = (float *) &stateBlock->textureState[(int) psi->bumpenvmatconst[i].texunit][WINED3DTSS_BUMPENVMAT00];
|
const float *data = (const float *)&stateBlock->textureState[(int) psi->bumpenvmatconst[i].texunit][WINED3DTSS_BUMPENVMAT00];
|
||||||
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, psi->bumpenvmatconst[i].const_num, data));
|
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, psi->bumpenvmatconst[i].const_num, data));
|
||||||
deviceImpl->activeContext->pshader_const_dirty[psi->bumpenvmatconst[i].const_num] = 1;
|
deviceImpl->activeContext->pshader_const_dirty[psi->bumpenvmatconst[i].const_num] = 1;
|
||||||
|
|
||||||
|
@ -215,7 +216,7 @@ static void shader_arb_load_constants(
|
||||||
* don't care about them. The pointers are valid for sure because the stateblock is bigger.
|
* don't care about them. The pointers are valid for sure because the stateblock is bigger.
|
||||||
* (they're WINED3DTSS_TEXTURETRANSFORMFLAGS and WINED3DTSS_ADDRESSW, so most likely 0 or NaN
|
* (they're WINED3DTSS_TEXTURETRANSFORMFLAGS and WINED3DTSS_ADDRESSW, so most likely 0 or NaN
|
||||||
*/
|
*/
|
||||||
float *scale = (float *) &stateBlock->textureState[(int) psi->luminanceconst[i].texunit][WINED3DTSS_BUMPENVLSCALE];
|
const float *scale = (const float *)&stateBlock->textureState[(int) psi->luminanceconst[i].texunit][WINED3DTSS_BUMPENVLSCALE];
|
||||||
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, psi->luminanceconst[i].const_num, scale));
|
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, psi->luminanceconst[i].const_num, scale));
|
||||||
deviceImpl->activeContext->pshader_const_dirty[psi->luminanceconst[i].const_num] = 1;
|
deviceImpl->activeContext->pshader_const_dirty[psi->luminanceconst[i].const_num] = 1;
|
||||||
}
|
}
|
||||||
|
@ -224,12 +225,9 @@ static void shader_arb_load_constants(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generate the variable & register declarations for the ARB_vertex_program output target */
|
/* Generate the variable & register declarations for the ARB_vertex_program output target */
|
||||||
static void shader_generate_arb_declarations(
|
static void shader_generate_arb_declarations(IWineD3DBaseShader *iface, const shader_reg_maps *reg_maps,
|
||||||
IWineD3DBaseShader *iface,
|
SHADER_BUFFER *buffer, const WineD3D_GL_Info *gl_info)
|
||||||
shader_reg_maps* reg_maps,
|
{
|
||||||
SHADER_BUFFER* buffer,
|
|
||||||
WineD3D_GL_Info* gl_info) {
|
|
||||||
|
|
||||||
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
|
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
|
||||||
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device;
|
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device;
|
||||||
DWORD i, cur;
|
DWORD i, cur;
|
||||||
|
@ -237,7 +235,7 @@ static void shader_generate_arb_declarations(
|
||||||
unsigned max_constantsF = min(This->baseShader.limits.constant_float,
|
unsigned max_constantsF = min(This->baseShader.limits.constant_float,
|
||||||
(pshader ? GL_LIMITS(pshader_constantsF) : GL_LIMITS(vshader_constantsF)));
|
(pshader ? GL_LIMITS(pshader_constantsF) : GL_LIMITS(vshader_constantsF)));
|
||||||
UINT extra_constants_needed = 0;
|
UINT extra_constants_needed = 0;
|
||||||
local_constant* lconst;
|
const local_constant *lconst;
|
||||||
|
|
||||||
/* Temporary Output register */
|
/* Temporary Output register */
|
||||||
shader_addline(buffer, "TEMP TMP_OUT;\n");
|
shader_addline(buffer, "TEMP TMP_OUT;\n");
|
||||||
|
@ -599,7 +597,8 @@ static void shader_hw_sample(const SHADER_OPCODE_ARG *arg, DWORD sampler_idx, co
|
||||||
|
|
||||||
static void gen_color_correction(SHADER_BUFFER *buffer, const char *reg, const char *writemask,
|
static void gen_color_correction(SHADER_BUFFER *buffer, const char *reg, const char *writemask,
|
||||||
const char *one, const char *two, WINED3DFORMAT fmt,
|
const char *one, const char *two, WINED3DFORMAT fmt,
|
||||||
WineD3D_GL_Info *gl_info) {
|
const WineD3D_GL_Info *gl_info)
|
||||||
|
{
|
||||||
switch(fmt) {
|
switch(fmt) {
|
||||||
case WINED3DFMT_V8U8:
|
case WINED3DFMT_V8U8:
|
||||||
case WINED3DFMT_V16U16:
|
case WINED3DFMT_V16U16:
|
||||||
|
@ -744,10 +743,11 @@ static void gen_color_correction(SHADER_BUFFER *buffer, const char *reg, const c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shader_arb_color_correction(SHADER_OPCODE_ARG* arg) {
|
static void shader_arb_color_correction(const SHADER_OPCODE_ARG* arg)
|
||||||
|
{
|
||||||
IWineD3DBaseShaderImpl* shader = (IWineD3DBaseShaderImpl*) arg->shader;
|
IWineD3DBaseShaderImpl* shader = (IWineD3DBaseShaderImpl*) arg->shader;
|
||||||
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) shader->baseShader.device;
|
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) shader->baseShader.device;
|
||||||
WineD3D_GL_Info *gl_info = &deviceImpl->adapter->gl_info;
|
const WineD3D_GL_Info *gl_info = &deviceImpl->adapter->gl_info;
|
||||||
WINED3DFORMAT fmt;
|
WINED3DFORMAT fmt;
|
||||||
WINED3DFORMAT conversion_group;
|
WINED3DFORMAT conversion_group;
|
||||||
IWineD3DBaseTextureImpl *texture;
|
IWineD3DBaseTextureImpl *texture;
|
||||||
|
@ -886,13 +886,9 @@ static void pshader_gen_input_modifier_line (
|
||||||
sprintf(outregstr, "T%c%s", 'A' + tmpreg, swzstr);
|
sprintf(outregstr, "T%c%s", 'A' + tmpreg, swzstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void pshader_gen_output_modifier_line(
|
static inline void pshader_gen_output_modifier_line(SHADER_BUFFER *buffer, int saturate, const char *write_mask,
|
||||||
SHADER_BUFFER* buffer,
|
int shift, const char *regstr)
|
||||||
int saturate,
|
{
|
||||||
char *write_mask,
|
|
||||||
int shift,
|
|
||||||
char *regstr) {
|
|
||||||
|
|
||||||
/* Generate a line that does the output modifier computation */
|
/* Generate a line that does the output modifier computation */
|
||||||
shader_addline(buffer, "MUL%s %s%s, %s, %s;\n", saturate ? "_SAT" : "",
|
shader_addline(buffer, "MUL%s %s%s, %s, %s;\n", saturate ? "_SAT" : "",
|
||||||
regstr, write_mask, regstr, shift_tab[shift]);
|
regstr, write_mask, regstr, shift_tab[shift]);
|
||||||
|
@ -1752,7 +1748,8 @@ static void shader_hw_sincos(const SHADER_OPCODE_ARG *arg)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLuint create_arb_blt_vertex_program(WineD3D_GL_Info *gl_info) {
|
static GLuint create_arb_blt_vertex_program(const WineD3D_GL_Info *gl_info)
|
||||||
|
{
|
||||||
GLuint program_id = 0;
|
GLuint program_id = 0;
|
||||||
const char *blt_vprogram =
|
const char *blt_vprogram =
|
||||||
"!!ARBvp1.0\n"
|
"!!ARBvp1.0\n"
|
||||||
|
@ -1776,7 +1773,7 @@ static GLuint create_arb_blt_vertex_program(WineD3D_GL_Info *gl_info) {
|
||||||
return program_id;
|
return program_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLuint create_arb_blt_fragment_program(WineD3D_GL_Info *gl_info, enum tex_types tex_type)
|
static GLuint create_arb_blt_fragment_program(const WineD3D_GL_Info *gl_info, enum tex_types tex_type)
|
||||||
{
|
{
|
||||||
GLuint program_id = 0;
|
GLuint program_id = 0;
|
||||||
const char *blt_fprograms[tex_type_count] =
|
const char *blt_fprograms[tex_type_count] =
|
||||||
|
@ -1828,7 +1825,7 @@ static GLuint create_arb_blt_fragment_program(WineD3D_GL_Info *gl_info, enum tex
|
||||||
static void shader_arb_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {
|
static void shader_arb_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
struct shader_arb_priv *priv = (struct shader_arb_priv *) This->shader_priv;
|
struct shader_arb_priv *priv = (struct shader_arb_priv *) This->shader_priv;
|
||||||
WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
|
const WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
|
||||||
|
|
||||||
if (useVS) {
|
if (useVS) {
|
||||||
TRACE("Using vertex shader\n");
|
TRACE("Using vertex shader\n");
|
||||||
|
@ -1882,7 +1879,7 @@ static void shader_arb_select_depth_blt(IWineD3DDevice *iface, enum tex_types te
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
struct shader_arb_priv *priv = (struct shader_arb_priv *) This->shader_priv;
|
struct shader_arb_priv *priv = (struct shader_arb_priv *) This->shader_priv;
|
||||||
GLuint *blt_fprogram = &priv->depth_blt_fprogram_id[tex_type];
|
GLuint *blt_fprogram = &priv->depth_blt_fprogram_id[tex_type];
|
||||||
WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
|
const WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
|
||||||
|
|
||||||
if (!priv->depth_blt_vprogram_id) priv->depth_blt_vprogram_id = create_arb_blt_vertex_program(gl_info);
|
if (!priv->depth_blt_vprogram_id) priv->depth_blt_vprogram_id = create_arb_blt_vertex_program(gl_info);
|
||||||
GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, priv->depth_blt_vprogram_id));
|
GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, priv->depth_blt_vprogram_id));
|
||||||
|
@ -1896,7 +1893,7 @@ static void shader_arb_select_depth_blt(IWineD3DDevice *iface, enum tex_types te
|
||||||
static void shader_arb_deselect_depth_blt(IWineD3DDevice *iface) {
|
static void shader_arb_deselect_depth_blt(IWineD3DDevice *iface) {
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
struct shader_arb_priv *priv = (struct shader_arb_priv *) This->shader_priv;
|
struct shader_arb_priv *priv = (struct shader_arb_priv *) This->shader_priv;
|
||||||
WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
|
const WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
|
||||||
|
|
||||||
if (priv->current_vprogram_id) {
|
if (priv->current_vprogram_id) {
|
||||||
GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, priv->current_vprogram_id));
|
GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, priv->current_vprogram_id));
|
||||||
|
@ -1927,14 +1924,14 @@ static void shader_arb_deselect_depth_blt(IWineD3DDevice *iface) {
|
||||||
|
|
||||||
static void shader_arb_cleanup(IWineD3DDevice *iface) {
|
static void shader_arb_cleanup(IWineD3DDevice *iface) {
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
|
const WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
|
||||||
if (GL_SUPPORT(ARB_VERTEX_PROGRAM)) glDisable(GL_VERTEX_PROGRAM_ARB);
|
if (GL_SUPPORT(ARB_VERTEX_PROGRAM)) glDisable(GL_VERTEX_PROGRAM_ARB);
|
||||||
if (GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) glDisable(GL_FRAGMENT_PROGRAM_ARB);
|
if (GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) glDisable(GL_FRAGMENT_PROGRAM_ARB);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shader_arb_destroy(IWineD3DBaseShader *iface) {
|
static void shader_arb_destroy(IWineD3DBaseShader *iface) {
|
||||||
IWineD3DBaseShaderImpl *baseShader = (IWineD3DBaseShaderImpl *) iface;
|
IWineD3DBaseShaderImpl *baseShader = (IWineD3DBaseShaderImpl *) iface;
|
||||||
WineD3D_GL_Info *gl_info = &((IWineD3DDeviceImpl *) baseShader->baseShader.device)->adapter->gl_info;
|
const WineD3D_GL_Info *gl_info = &((IWineD3DDeviceImpl *)baseShader->baseShader.device)->adapter->gl_info;
|
||||||
char pshader = shader_is_pshader_version(baseShader->baseShader.hex_version);
|
char pshader = shader_is_pshader_version(baseShader->baseShader.hex_version);
|
||||||
|
|
||||||
if(pshader) {
|
if(pshader) {
|
||||||
|
@ -1970,7 +1967,7 @@ static HRESULT shader_arb_alloc(IWineD3DDevice *iface) {
|
||||||
|
|
||||||
static void shader_arb_free(IWineD3DDevice *iface) {
|
static void shader_arb_free(IWineD3DDevice *iface) {
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
|
const WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
|
||||||
struct shader_arb_priv *priv = (struct shader_arb_priv *) This->shader_priv;
|
struct shader_arb_priv *priv = (struct shader_arb_priv *) This->shader_priv;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -2014,11 +2011,11 @@ static void arbfp_add_sRGB_correction(SHADER_BUFFER *buffer, const char *fragcol
|
||||||
|
|
||||||
static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer) {
|
static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer) {
|
||||||
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
|
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
|
||||||
shader_reg_maps* reg_maps = &This->baseShader.reg_maps;
|
const shader_reg_maps* reg_maps = &This->baseShader.reg_maps;
|
||||||
CONST DWORD *function = This->baseShader.function;
|
CONST DWORD *function = This->baseShader.function;
|
||||||
const char *fragcolor;
|
const char *fragcolor;
|
||||||
WineD3D_GL_Info *gl_info = &((IWineD3DDeviceImpl *)This->baseShader.device)->adapter->gl_info;
|
const WineD3D_GL_Info *gl_info = &((IWineD3DDeviceImpl *)This->baseShader.device)->adapter->gl_info;
|
||||||
local_constant* lconst;
|
const local_constant *lconst;
|
||||||
GLuint retval;
|
GLuint retval;
|
||||||
|
|
||||||
/* Create the hw ARB shader */
|
/* Create the hw ARB shader */
|
||||||
|
@ -2088,7 +2085,7 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUF
|
||||||
/* Load immediate constants */
|
/* Load immediate constants */
|
||||||
if(!This->baseShader.load_local_constsF) {
|
if(!This->baseShader.load_local_constsF) {
|
||||||
LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) {
|
LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) {
|
||||||
float *value = (float *) lconst->value;
|
const float *value = (const float *)lconst->value;
|
||||||
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, lconst->idx, value));
|
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, lconst->idx, value));
|
||||||
checkGLcall("glProgramLocalParameter4fvARB");
|
checkGLcall("glProgramLocalParameter4fvARB");
|
||||||
}
|
}
|
||||||
|
@ -2099,11 +2096,11 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUF
|
||||||
|
|
||||||
static void shader_arb_generate_vshader(IWineD3DVertexShader *iface, SHADER_BUFFER *buffer) {
|
static void shader_arb_generate_vshader(IWineD3DVertexShader *iface, SHADER_BUFFER *buffer) {
|
||||||
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface;
|
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface;
|
||||||
shader_reg_maps* reg_maps = &This->baseShader.reg_maps;
|
const shader_reg_maps *reg_maps = &This->baseShader.reg_maps;
|
||||||
CONST DWORD *function = This->baseShader.function;
|
CONST DWORD *function = This->baseShader.function;
|
||||||
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)This->baseShader.device;
|
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)This->baseShader.device;
|
||||||
WineD3D_GL_Info *gl_info = &device->adapter->gl_info;
|
const WineD3D_GL_Info *gl_info = &device->adapter->gl_info;
|
||||||
local_constant* lconst;
|
const local_constant *lconst;
|
||||||
|
|
||||||
/* Create the hw ARB shader */
|
/* Create the hw ARB shader */
|
||||||
shader_addline(buffer, "!!ARBvp1.0\n");
|
shader_addline(buffer, "!!ARBvp1.0\n");
|
||||||
|
@ -2196,13 +2193,14 @@ static void shader_arb_generate_vshader(IWineD3DVertexShader *iface, SHADER_BUFF
|
||||||
/* Load immediate constants */
|
/* Load immediate constants */
|
||||||
if(!This->baseShader.load_local_constsF) {
|
if(!This->baseShader.load_local_constsF) {
|
||||||
LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) {
|
LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) {
|
||||||
float *value = (float *) lconst->value;
|
const float *value = (const float *)lconst->value;
|
||||||
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, lconst->idx, value));
|
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, lconst->idx, value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shader_arb_get_caps(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct shader_caps *pCaps) {
|
static void shader_arb_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct shader_caps *pCaps)
|
||||||
|
{
|
||||||
/* We don't have an ARB fixed function pipeline yet, so let the none backend set its caps,
|
/* We don't have an ARB fixed function pipeline yet, so let the none backend set its caps,
|
||||||
* then overwrite the shader specific ones
|
* then overwrite the shader specific ones
|
||||||
*/
|
*/
|
||||||
|
@ -2387,7 +2385,7 @@ static HRESULT arbfp_alloc(IWineD3DDevice *iface) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void arbfp_free_ffpshader(void *value, void *gli) {
|
static void arbfp_free_ffpshader(void *value, void *gli) {
|
||||||
WineD3D_GL_Info *gl_info = gli;
|
const WineD3D_GL_Info *gl_info = gli;
|
||||||
struct arbfp_ffp_desc *entry_arb = value;
|
struct arbfp_ffp_desc *entry_arb = value;
|
||||||
|
|
||||||
ENTER_GL();
|
ENTER_GL();
|
||||||
|
@ -2409,7 +2407,8 @@ static void arbfp_free(IWineD3DDevice *iface) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void arbfp_get_caps(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct fragment_caps *caps) {
|
static void arbfp_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct fragment_caps *caps)
|
||||||
|
{
|
||||||
caps->TextureOpCaps = WINED3DTEXOPCAPS_DISABLE |
|
caps->TextureOpCaps = WINED3DTEXOPCAPS_DISABLE |
|
||||||
WINED3DTEXOPCAPS_SELECTARG1 |
|
WINED3DTEXOPCAPS_SELECTARG1 |
|
||||||
WINED3DTEXOPCAPS_SELECTARG2 |
|
WINED3DTEXOPCAPS_SELECTARG2 |
|
||||||
|
@ -2772,7 +2771,8 @@ static void gen_ffp_instr(SHADER_BUFFER *buffer, unsigned int stage, BOOL color,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The stateblock is passed for GLINFO_LOCATION */
|
/* The stateblock is passed for GLINFO_LOCATION */
|
||||||
static GLuint gen_arbfp_ffp_shader(struct ffp_frag_settings *settings, IWineD3DStateBlockImpl *stateblock) {
|
static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWineD3DStateBlockImpl *stateblock)
|
||||||
|
{
|
||||||
unsigned int stage;
|
unsigned int stage;
|
||||||
SHADER_BUFFER buffer;
|
SHADER_BUFFER buffer;
|
||||||
BOOL tex_read[MAX_TEXTURES] = {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE};
|
BOOL tex_read[MAX_TEXTURES] = {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE};
|
||||||
|
|
|
@ -1019,7 +1019,8 @@ static void atifs_enable(IWineD3DDevice *iface, BOOL enable) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void atifs_get_caps(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct fragment_caps *caps) {
|
static void atifs_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct fragment_caps *caps)
|
||||||
|
{
|
||||||
caps->TextureOpCaps = WINED3DTEXOPCAPS_DISABLE |
|
caps->TextureOpCaps = WINED3DTEXOPCAPS_DISABLE |
|
||||||
WINED3DTEXOPCAPS_SELECTARG1 |
|
WINED3DTEXOPCAPS_SELECTARG1 |
|
||||||
WINED3DTEXOPCAPS_SELECTARG2 |
|
WINED3DTEXOPCAPS_SELECTARG2 |
|
||||||
|
|
|
@ -782,12 +782,9 @@ void shader_dump_param(
|
||||||
Use the shader_header_fct & shader_footer_fct to add strings
|
Use the shader_header_fct & shader_footer_fct to add strings
|
||||||
that are specific to pixel or vertex functions
|
that are specific to pixel or vertex functions
|
||||||
NOTE: A description of how to parse tokens can be found on msdn */
|
NOTE: A description of how to parse tokens can be found on msdn */
|
||||||
void shader_generate_main(
|
void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER* buffer,
|
||||||
IWineD3DBaseShader *iface,
|
const shader_reg_maps* reg_maps, CONST DWORD* pFunction)
|
||||||
SHADER_BUFFER* buffer,
|
{
|
||||||
shader_reg_maps* reg_maps,
|
|
||||||
CONST DWORD* pFunction) {
|
|
||||||
|
|
||||||
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
|
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
|
||||||
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device; /* To access shader backend callbacks */
|
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device; /* To access shader backend callbacks */
|
||||||
const SHADER_HANDLER *handler_table = device->shader_backend->shader_instruction_handler_table;
|
const SHADER_HANDLER *handler_table = device->shader_backend->shader_instruction_handler_table;
|
||||||
|
@ -1096,7 +1093,7 @@ static void shader_none_select_depth_blt(IWineD3DDevice *iface, enum tex_types t
|
||||||
static void shader_none_deselect_depth_blt(IWineD3DDevice *iface) {}
|
static void shader_none_deselect_depth_blt(IWineD3DDevice *iface) {}
|
||||||
static void shader_none_load_constants(IWineD3DDevice *iface, char usePS, char useVS) {}
|
static void shader_none_load_constants(IWineD3DDevice *iface, char usePS, char useVS) {}
|
||||||
static void shader_none_cleanup(IWineD3DDevice *iface) {}
|
static void shader_none_cleanup(IWineD3DDevice *iface) {}
|
||||||
static void shader_none_color_correction(SHADER_OPCODE_ARG* arg) {}
|
static void shader_none_color_correction(const SHADER_OPCODE_ARG *arg) {}
|
||||||
static void shader_none_destroy(IWineD3DBaseShader *iface) {}
|
static void shader_none_destroy(IWineD3DBaseShader *iface) {}
|
||||||
static HRESULT shader_none_alloc(IWineD3DDevice *iface) {return WINED3D_OK;}
|
static HRESULT shader_none_alloc(IWineD3DDevice *iface) {return WINED3D_OK;}
|
||||||
static void shader_none_free(IWineD3DDevice *iface) {}
|
static void shader_none_free(IWineD3DDevice *iface) {}
|
||||||
|
@ -1110,7 +1107,8 @@ static void shader_none_generate_vshader(IWineD3DVertexShader *iface, SHADER_BUF
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GLINFO_LOCATION (*gl_info)
|
#define GLINFO_LOCATION (*gl_info)
|
||||||
static void shader_none_get_caps(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct shader_caps *pCaps) {
|
static void shader_none_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct shader_caps *pCaps)
|
||||||
|
{
|
||||||
/* Set the shader caps to 0 for the none shader backend */
|
/* Set the shader caps to 0 for the none shader backend */
|
||||||
pCaps->VertexShaderVersion = 0;
|
pCaps->VertexShaderVersion = 0;
|
||||||
pCaps->PixelShaderVersion = 0;
|
pCaps->PixelShaderVersion = 0;
|
||||||
|
|
|
@ -1186,7 +1186,8 @@ static void shader_glsl_get_sample_function(DWORD sampler_type, BOOL projected,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shader_glsl_color_correction(SHADER_OPCODE_ARG* arg) {
|
static void shader_glsl_color_correction(const SHADER_OPCODE_ARG *arg)
|
||||||
|
{
|
||||||
IWineD3DBaseShaderImpl* shader = (IWineD3DBaseShaderImpl*) arg->shader;
|
IWineD3DBaseShaderImpl* shader = (IWineD3DBaseShaderImpl*) arg->shader;
|
||||||
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) shader->baseShader.device;
|
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) shader->baseShader.device;
|
||||||
WineD3D_GL_Info *gl_info = &deviceImpl->adapter->gl_info;
|
WineD3D_GL_Info *gl_info = &deviceImpl->adapter->gl_info;
|
||||||
|
@ -3805,7 +3806,8 @@ static void shader_glsl_generate_vshader(IWineD3DVertexShader *iface, SHADER_BUF
|
||||||
This->prgId = shader_obj;
|
This->prgId = shader_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shader_glsl_get_caps(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct shader_caps *pCaps) {
|
static void shader_glsl_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct shader_caps *pCaps)
|
||||||
|
{
|
||||||
/* Nvidia Geforce6/7 or Ati R4xx/R5xx cards with GLSL support, support VS 3.0 but older Nvidia/Ati
|
/* Nvidia Geforce6/7 or Ati R4xx/R5xx cards with GLSL support, support VS 3.0 but older Nvidia/Ati
|
||||||
* models with GLSL support only support 2.0. In case of nvidia we can detect VS 2.0 support using
|
* models with GLSL support only support 2.0. In case of nvidia we can detect VS 2.0 support using
|
||||||
* vs_nv_version which is based on NV_vertex_program.
|
* vs_nv_version which is based on NV_vertex_program.
|
||||||
|
|
|
@ -610,7 +610,8 @@ static void nvts_enable(IWineD3DDevice *iface, BOOL enable) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nvrc_fragment_get_caps(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct fragment_caps *pCaps) {
|
static void nvrc_fragment_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct fragment_caps *pCaps)
|
||||||
|
{
|
||||||
pCaps->TextureOpCaps = WINED3DTEXOPCAPS_ADD |
|
pCaps->TextureOpCaps = WINED3DTEXOPCAPS_ADD |
|
||||||
WINED3DTEXOPCAPS_ADDSIGNED |
|
WINED3DTEXOPCAPS_ADDSIGNED |
|
||||||
WINED3DTEXOPCAPS_ADDSIGNED2X |
|
WINED3DTEXOPCAPS_ADDSIGNED2X |
|
||||||
|
|
|
@ -5437,7 +5437,8 @@ static const struct StateEntryTemplate ffp_fragmentstate_template[] = {
|
||||||
#define GLINFO_LOCATION (*gl_info)
|
#define GLINFO_LOCATION (*gl_info)
|
||||||
static void ffp_enable(IWineD3DDevice *iface, BOOL enable) { }
|
static void ffp_enable(IWineD3DDevice *iface, BOOL enable) { }
|
||||||
|
|
||||||
static void ffp_fragment_get_caps(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct fragment_caps *pCaps) {
|
static void ffp_fragment_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct fragment_caps *pCaps)
|
||||||
|
{
|
||||||
pCaps->TextureOpCaps = WINED3DTEXOPCAPS_ADD |
|
pCaps->TextureOpCaps = WINED3DTEXOPCAPS_ADD |
|
||||||
WINED3DTEXOPCAPS_ADDSIGNED |
|
WINED3DTEXOPCAPS_ADDSIGNED |
|
||||||
WINED3DTEXOPCAPS_ADDSIGNED2X |
|
WINED3DTEXOPCAPS_ADDSIGNED2X |
|
||||||
|
|
|
@ -345,14 +345,14 @@ typedef struct {
|
||||||
void (*shader_deselect_depth_blt)(IWineD3DDevice *iface);
|
void (*shader_deselect_depth_blt)(IWineD3DDevice *iface);
|
||||||
void (*shader_load_constants)(IWineD3DDevice *iface, char usePS, char useVS);
|
void (*shader_load_constants)(IWineD3DDevice *iface, char usePS, char useVS);
|
||||||
void (*shader_cleanup)(IWineD3DDevice *iface);
|
void (*shader_cleanup)(IWineD3DDevice *iface);
|
||||||
void (*shader_color_correction)(struct SHADER_OPCODE_ARG *arg);
|
void (*shader_color_correction)(const struct SHADER_OPCODE_ARG *arg);
|
||||||
void (*shader_destroy)(IWineD3DBaseShader *iface);
|
void (*shader_destroy)(IWineD3DBaseShader *iface);
|
||||||
HRESULT (*shader_alloc_private)(IWineD3DDevice *iface);
|
HRESULT (*shader_alloc_private)(IWineD3DDevice *iface);
|
||||||
void (*shader_free_private)(IWineD3DDevice *iface);
|
void (*shader_free_private)(IWineD3DDevice *iface);
|
||||||
BOOL (*shader_dirtifyable_constants)(IWineD3DDevice *iface);
|
BOOL (*shader_dirtifyable_constants)(IWineD3DDevice *iface);
|
||||||
GLuint (*shader_generate_pshader)(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer);
|
GLuint (*shader_generate_pshader)(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer);
|
||||||
void (*shader_generate_vshader)(IWineD3DVertexShader *iface, SHADER_BUFFER *buffer);
|
void (*shader_generate_vshader)(IWineD3DVertexShader *iface, SHADER_BUFFER *buffer);
|
||||||
void (*shader_get_caps)(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct shader_caps *caps);
|
void (*shader_get_caps)(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct shader_caps *caps);
|
||||||
BOOL (*shader_conv_supported)(WINED3DFORMAT conv);
|
BOOL (*shader_conv_supported)(WINED3DFORMAT conv);
|
||||||
} shader_backend_t;
|
} shader_backend_t;
|
||||||
|
|
||||||
|
@ -642,7 +642,7 @@ struct fragment_caps {
|
||||||
|
|
||||||
struct fragment_pipeline {
|
struct fragment_pipeline {
|
||||||
void (*enable_extension)(IWineD3DDevice *iface, BOOL enable);
|
void (*enable_extension)(IWineD3DDevice *iface, BOOL enable);
|
||||||
void (*get_caps)(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct fragment_caps *caps);
|
void (*get_caps)(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct fragment_caps *caps);
|
||||||
HRESULT (*alloc_private)(IWineD3DDevice *iface);
|
HRESULT (*alloc_private)(IWineD3DDevice *iface);
|
||||||
void (*free_private)(IWineD3DDevice *iface);
|
void (*free_private)(IWineD3DDevice *iface);
|
||||||
BOOL (*conv_supported)(WINED3DFORMAT conv);
|
BOOL (*conv_supported)(WINED3DFORMAT conv);
|
||||||
|
@ -2066,7 +2066,7 @@ typedef struct SHADER_OPCODE {
|
||||||
|
|
||||||
typedef struct SHADER_OPCODE_ARG {
|
typedef struct SHADER_OPCODE_ARG {
|
||||||
IWineD3DBaseShader* shader;
|
IWineD3DBaseShader* shader;
|
||||||
shader_reg_maps* reg_maps;
|
const shader_reg_maps *reg_maps;
|
||||||
CONST SHADER_OPCODE* opcode;
|
CONST SHADER_OPCODE* opcode;
|
||||||
DWORD opcode_token;
|
DWORD opcode_token;
|
||||||
DWORD dst;
|
DWORD dst;
|
||||||
|
@ -2194,11 +2194,8 @@ extern HRESULT shader_get_registers_used(
|
||||||
CONST DWORD* pToken,
|
CONST DWORD* pToken,
|
||||||
IWineD3DStateBlockImpl *stateBlock);
|
IWineD3DStateBlockImpl *stateBlock);
|
||||||
|
|
||||||
extern void shader_generate_main(
|
extern void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER *buffer,
|
||||||
IWineD3DBaseShader *iface,
|
const shader_reg_maps *reg_maps, const DWORD *pFunction);
|
||||||
SHADER_BUFFER* buffer,
|
|
||||||
shader_reg_maps* reg_maps,
|
|
||||||
CONST DWORD* pFunction);
|
|
||||||
|
|
||||||
extern void shader_dump_ins_modifiers(
|
extern void shader_dump_ins_modifiers(
|
||||||
const DWORD output);
|
const DWORD output);
|
||||||
|
|
Loading…
Reference in New Issue