Skip to content

Commit

Permalink
wined3d: Report actual vertex shader float constants limit for SWVP d…
Browse files Browse the repository at this point in the history
…evice.
  • Loading branch information
gofman authored and Guy1524 committed Apr 6, 2020
1 parent 10100c9 commit d8801e5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion dlls/wined3d/adapter_gl.c
Original file line number Diff line number Diff line change
Expand Up @@ -5153,7 +5153,8 @@ static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *adapter_
d3d_info->limits.gs_version = shader_caps.gs_version;
d3d_info->limits.ps_version = shader_caps.ps_version;
d3d_info->limits.cs_version = shader_caps.cs_version;
d3d_info->limits.vs_uniform_count = shader_caps.vs_uniform_count;
d3d_info->limits.vs_uniform_count_swvp = shader_caps.vs_uniform_count;
d3d_info->limits.vs_uniform_count = min(WINED3D_MAX_VS_CONSTS_F, shader_caps.vs_uniform_count);
d3d_info->limits.ps_uniform_count = shader_caps.ps_uniform_count;
d3d_info->limits.varying_count = shader_caps.varying_count;
d3d_info->limits.ffp_textures = fragment_caps.MaxSimultaneousTextures;
Expand Down
9 changes: 8 additions & 1 deletion dlls/wined3d/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -3835,9 +3835,16 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,

HRESULT CDECL wined3d_device_get_device_caps(const struct wined3d_device *device, struct wined3d_caps *caps)
{
HRESULT hr;

TRACE("device %p, caps %p.\n", device, caps);

return wined3d_get_device_caps(device->adapter, device->create_parms.device_type, caps);
if (FAILED(hr = wined3d_get_device_caps(device->adapter, device->create_parms.device_type, caps)))
return hr;

if (device->create_parms.flags & WINED3DCREATE_SOFTWARE_VERTEXPROCESSING)
caps->MaxVertexShaderConst = device->adapter->d3d_info.limits.vs_uniform_count_swvp;
return hr;
}

HRESULT CDECL wined3d_device_get_display_mode(const struct wined3d_device *device, UINT swapchain_idx,
Expand Down
5 changes: 4 additions & 1 deletion dlls/wined3d/glsl_shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -11277,7 +11277,10 @@ static void shader_glsl_get_caps(const struct wined3d_adapter *adapter, struct s
caps->vs_version = gl_info->supported[ARB_VERTEX_SHADER] ? caps->vs_version : 0;
caps->ps_version = gl_info->supported[ARB_FRAGMENT_SHADER] ? caps->ps_version : 0;

caps->vs_uniform_count = min(WINED3D_MAX_VS_CONSTS_F, gl_info->limits.glsl_vs_float_constants);
caps->vs_uniform_count = min(WINED3D_MAX_VS_CONSTS_F_SWVP,
gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT]
? gl_info->limits.glsl_max_uniform_block_size / sizeof(struct wined3d_vec4)
: gl_info->limits.glsl_vs_float_constants);
caps->ps_uniform_count = min(WINED3D_MAX_PS_CONSTS_F, gl_info->limits.glsl_ps_float_constants);
caps->varying_count = gl_info->limits.glsl_varyings;

Expand Down
1 change: 1 addition & 0 deletions dlls/wined3d/wined3d_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ struct wined3d_d3d_limits
{
unsigned int vs_version, hs_version, ds_version, gs_version, ps_version, cs_version;
DWORD vs_uniform_count;
DWORD vs_uniform_count_swvp;
DWORD ps_uniform_count;
unsigned int varying_count;
unsigned int ffp_textures;
Expand Down
1 change: 1 addition & 0 deletions include/wine/wined3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -1604,6 +1604,7 @@ enum wined3d_shader_type
#define WINED3D_MAX_CONSTS_B 16
#define WINED3D_MAX_CONSTS_I 16
#define WINED3D_MAX_VS_CONSTS_F 256
#define WINED3D_MAX_VS_CONSTS_F_SWVP 8192
#define WINED3D_MAX_PS_CONSTS_F 224
#define WINED3D_MAX_RENDER_TARGETS 8

Expand Down

0 comments on commit d8801e5

Please sign in to comment.