Commit 40bc4790 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Use flags for driver quirks.

parent c475789b
......@@ -49,9 +49,10 @@ static BOOL need_mova_const(IWineD3DBaseShader *shader, const WineD3D_GL_Info *g
}
static BOOL need_helper_const(const WineD3D_GL_Info *gl_info) {
if(!GL_SUPPORT(NV_VERTEX_PROGRAM) || /* Need to init colors */
gl_info->arb_vs_offset_limit || /* Have to init texcoords */
gl_info->set_texcoord_w) { /* Load the immval offset */
if (!GL_SUPPORT(NV_VERTEX_PROGRAM) /* Need to init colors. */
|| gl_info->quirks & WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT /* Load the immval offset. */
|| gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W) /* Have to init texcoords. */
{
return TRUE;
}
return FALSE;
......@@ -3751,7 +3752,8 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This,
if(!GL_SUPPORT(NV_VERTEX_PROGRAM)) {
shader_addline(buffer, "MOV result.color.secondary, -helper_const.wwwy;\n");
if((GLINFO_LOCATION).set_texcoord_w && !device->frag_pipe->ffp_proj_control) {
if ((GLINFO_LOCATION).quirks & WINED3D_QUIRK_SET_TEXCOORD_W && !device->frag_pipe->ffp_proj_control)
{
int i;
for(i = 0; i < min(8, MAX_REG_TEXCRD); i++) {
if(This->baseShader.reg_maps.texcoord_mask[i] != 0 &&
......
......@@ -950,7 +950,7 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
gl_info->vs_arb_max_instructions = gl_max;
TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native instructions: %d\n", gl_info->vs_arb_max_instructions);
gl_info->arb_vs_offset_limit = test_arb_vs_offset_limit(gl_info);
if (test_arb_vs_offset_limit(gl_info)) gl_info->quirks |= WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT;
}
if (gl_info->supported[ARB_VERTEX_SHADER]) {
glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &gl_max);
......@@ -4196,11 +4196,11 @@ static void quirk_texcoord_w(WineD3D_GL_Info *gl_info) {
* performance negatively.
*/
TRACE("Enabling vertex texture coord fixes in vertex shaders\n");
gl_info->set_texcoord_w = TRUE;
gl_info->quirks |= WINED3D_QUIRK_SET_TEXCOORD_W;
}
static void quirk_clip_varying(WineD3D_GL_Info *gl_info) {
gl_info->glsl_clip_varying = TRUE;
gl_info->quirks |= WINED3D_QUIRK_GLSL_CLIP_VARYING;
}
struct driver_quirk
......
......@@ -776,7 +776,7 @@ static int vec4_varyings(DWORD shader_major, const WineD3D_GL_Info *gl_info)
if(shader_major > 3) return ret;
/* 3.0 shaders may need an extra varying for the clip coord on some cards(mostly dx10 ones) */
if(gl_info->glsl_clip_varying) ret -= 1;
if (gl_info->quirks & WINED3D_QUIRK_GLSL_CLIP_VARYING) ret -= 1;
return ret;
}
......@@ -3529,8 +3529,9 @@ static GLhandleARB generate_param_reorder_function(IWineD3DVertexShader *vertexs
* Take care about the texcoord .w fixup though if we're using the fixed function fragment pipeline
*/
device = (IWineD3DDeviceImpl *) vs->baseShader.device;
if((GLINFO_LOCATION).set_texcoord_w && ps_major == 0 && vs_major > 0 &&
!device->frag_pipe->ffp_proj_control) {
if (((GLINFO_LOCATION).quirks & WINED3D_QUIRK_SET_TEXCOORD_W)
&& ps_major == 0 && vs_major > 0 && !device->frag_pipe->ffp_proj_control)
{
shader_addline(&buffer, "void order_ps_input() {\n");
for(i = 0; i < min(8, MAX_REG_TEXCRD); i++) {
if(vs->baseShader.reg_maps.texcoord_mask[i] != 0 &&
......@@ -3575,7 +3576,8 @@ static GLhandleARB generate_param_reorder_function(IWineD3DVertexShader *vertexs
{
if (semantic_idx < 8)
{
if (!(GLINFO_LOCATION).set_texcoord_w || ps_major > 0) write_mask |= WINED3DSP_WRITEMASK_3;
if (!((GLINFO_LOCATION).quirks & WINED3D_QUIRK_SET_TEXCOORD_W) || ps_major > 0)
write_mask |= WINED3DSP_WRITEMASK_3;
shader_addline(&buffer, "gl_TexCoord[%u]%s = OUT[%u]%s;\n",
semantic_idx, reg_mask, i, reg_mask);
......
......@@ -280,10 +280,10 @@ static HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader
vshader_set_limits(This);
if(deviceImpl->vs_selected_mode == SHADER_ARB &&
(GLINFO_LOCATION).arb_vs_offset_limit &&
This->min_rel_offset <= This->max_rel_offset) {
if (deviceImpl->vs_selected_mode == SHADER_ARB
&& ((GLINFO_LOCATION).quirks & WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT)
&& This->min_rel_offset <= This->max_rel_offset)
{
if(This->max_rel_offset - This->min_rel_offset > 127) {
FIXME("The difference between the minimum and maximum relative offset is > 127\n");
FIXME("Which this OpenGL implementation does not support. Try using GLSL\n");
......
......@@ -4000,10 +4000,9 @@ typedef struct _WineD3D_GL_Info {
GL_VSVersion vs_nv_version;
GL_VSVersion vs_ati_version;
BOOL arb_vs_offset_limit;
BOOL set_texcoord_w;
DWORD reserved_glsl_constants;
BOOL glsl_clip_varying;
DWORD quirks;
BOOL supported[WINED3D_GL_EXT_COUNT];
......
......@@ -43,6 +43,11 @@
#include "wine/list.h"
#include "wine/rbtree.h"
/* Driver quirks */
#define WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT 0x00000001
#define WINED3D_QUIRK_SET_TEXCOORD_W 0x00000002
#define WINED3D_QUIRK_GLSL_CLIP_VARYING 0x00000004
/* Texture format fixups */
enum fixup_channel_source
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment