wined3d: Pass the ps_compile_args structures to the shader generation code.
This commit is contained in:
parent
936bec69cf
commit
61e581abb4
|
@ -1879,7 +1879,7 @@ static void arbfp_add_sRGB_correction(SHADER_BUFFER *buffer, const char *fragcol
|
||||||
/* [0.0;1.0] clamping. Not needed, this is done implicitly */
|
/* [0.0;1.0] clamping. Not needed, this is done implicitly */
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer) {
|
static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer, const struct ps_compile_args *args) {
|
||||||
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
|
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
|
||||||
const 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;
|
||||||
|
|
|
@ -1130,7 +1130,7 @@ 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) {}
|
||||||
static BOOL shader_none_dirty_const(IWineD3DDevice *iface) {return FALSE;}
|
static BOOL shader_none_dirty_const(IWineD3DDevice *iface) {return FALSE;}
|
||||||
static GLuint shader_none_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer) {
|
static GLuint shader_none_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer, const struct ps_compile_args *args) {
|
||||||
FIXME("NONE shader backend asked to generate a pixel shader\n");
|
FIXME("NONE shader backend asked to generate a pixel shader\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3610,7 +3610,7 @@ static BOOL shader_glsl_dirty_const(IWineD3DDevice *iface) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLuint shader_glsl_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer) {
|
static GLuint shader_glsl_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer, const struct ps_compile_args *args) {
|
||||||
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
|
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
|
||||||
const struct shader_reg_maps *reg_maps = &This->baseShader.reg_maps;
|
const struct shader_reg_maps *reg_maps = &This->baseShader.reg_maps;
|
||||||
CONST DWORD *function = This->baseShader.function;
|
CONST DWORD *function = This->baseShader.function;
|
||||||
|
|
|
@ -423,6 +423,7 @@ static GLuint pixelshader_compile(IWineD3DPixelShaderImpl *This, const struct ps
|
||||||
CONST DWORD *function = This->baseShader.function;
|
CONST DWORD *function = This->baseShader.function;
|
||||||
GLuint retval;
|
GLuint retval;
|
||||||
SHADER_BUFFER buffer;
|
SHADER_BUFFER buffer;
|
||||||
|
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device;
|
||||||
|
|
||||||
TRACE("(%p) : function %p\n", This, function);
|
TRACE("(%p) : function %p\n", This, function);
|
||||||
|
|
||||||
|
@ -435,7 +436,7 @@ static GLuint pixelshader_compile(IWineD3DPixelShaderImpl *This, const struct ps
|
||||||
/* Generate the HW shader */
|
/* Generate the HW shader */
|
||||||
TRACE("(%p) : Generating hardware program\n", This);
|
TRACE("(%p) : Generating hardware program\n", This);
|
||||||
shader_buffer_init(&buffer);
|
shader_buffer_init(&buffer);
|
||||||
retval = ((IWineD3DDeviceImpl *)This->baseShader.device)->shader_backend->shader_generate_pshader((IWineD3DPixelShader *)This, &buffer);
|
retval = device->shader_backend->shader_generate_pshader((IWineD3DPixelShader *)This, &buffer, args);
|
||||||
shader_buffer_free(&buffer);
|
shader_buffer_free(&buffer);
|
||||||
|
|
||||||
This->baseShader.is_compiled = TRUE;
|
This->baseShader.is_compiled = TRUE;
|
||||||
|
|
|
@ -427,6 +427,28 @@ enum tex_types
|
||||||
tex_type_count = 5,
|
tex_type_count = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum vertexprocessing_mode {
|
||||||
|
fixedfunction,
|
||||||
|
vertexshader,
|
||||||
|
pretransformed
|
||||||
|
};
|
||||||
|
|
||||||
|
struct stb_const_desc {
|
||||||
|
char texunit;
|
||||||
|
UINT const_num;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Stateblock dependent parameters which have to be hardcoded
|
||||||
|
* into the shader code
|
||||||
|
*/
|
||||||
|
struct ps_compile_args {
|
||||||
|
struct color_fixup_desc color_fixup[MAX_FRAGMENT_SAMPLERS];
|
||||||
|
BOOL srgb_correction;
|
||||||
|
enum vertexprocessing_mode vp_mode;
|
||||||
|
/* Projected textures(ps 1.0-1.3) */
|
||||||
|
/* Texture types(2D, Cube, 3D) in ps 1.x */
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const SHADER_HANDLER *shader_instruction_handler_table;
|
const SHADER_HANDLER *shader_instruction_handler_table;
|
||||||
void (*shader_select)(IWineD3DDevice *iface, BOOL usePS, BOOL useVS);
|
void (*shader_select)(IWineD3DDevice *iface, BOOL usePS, BOOL useVS);
|
||||||
|
@ -440,7 +462,7 @@ typedef struct {
|
||||||
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, const struct ps_compile_args *args);
|
||||||
void (*shader_generate_vshader)(IWineD3DVertexShader *iface, SHADER_BUFFER *buffer);
|
void (*shader_generate_vshader)(IWineD3DVertexShader *iface, SHADER_BUFFER *buffer);
|
||||||
void (*shader_get_caps)(WINED3DDEVTYPE devtype, const 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_color_fixup_supported)(struct color_fixup_desc fixup);
|
BOOL (*shader_color_fixup_supported)(struct color_fixup_desc fixup);
|
||||||
|
@ -2347,29 +2369,6 @@ HRESULT IWineD3DVertexShaderImpl_CompileShader(IWineD3DVertexShader *iface);
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* IDirect3DPixelShader implementation structure
|
* IDirect3DPixelShader implementation structure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum vertexprocessing_mode {
|
|
||||||
fixedfunction,
|
|
||||||
vertexshader,
|
|
||||||
pretransformed
|
|
||||||
};
|
|
||||||
|
|
||||||
struct stb_const_desc {
|
|
||||||
char texunit;
|
|
||||||
UINT const_num;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Stateblock dependent parameters which have to be hardcoded
|
|
||||||
* into the shader code
|
|
||||||
*/
|
|
||||||
struct ps_compile_args {
|
|
||||||
struct color_fixup_desc color_fixup[MAX_FRAGMENT_SAMPLERS];
|
|
||||||
BOOL srgb_correction;
|
|
||||||
enum vertexprocessing_mode vp_mode;
|
|
||||||
/* Projected textures(ps 1.0-1.3) */
|
|
||||||
/* Texture types(2D, Cube, 3D) in ps 1.x */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ps_compiled_shader {
|
struct ps_compiled_shader {
|
||||||
struct ps_compile_args args;
|
struct ps_compile_args args;
|
||||||
GLuint prgId;
|
GLuint prgId;
|
||||||
|
|
Loading…
Reference in New Issue