Commit 67529025 authored by Paul Gofman's avatar Paul Gofman Committed by Vitaly Lipatov

wined3d: Use UBO for vertex shader float constants if supported.

parent fea8be0e
...@@ -476,7 +476,7 @@ BOOL d3d8_init(struct d3d8 *d3d8) ...@@ -476,7 +476,7 @@ BOOL d3d8_init(struct d3d8 *d3d8)
DWORD flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING DWORD flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING
| WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER | WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER
| WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR | WINED3D_NO_PRIMITIVE_RESTART | WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR | WINED3D_NO_PRIMITIVE_RESTART
| WINED3D_LEGACY_CUBEMAP_FILTERING; | WINED3D_LEGACY_CUBEMAP_FILTERING | WINED3D_LEGACY_SHADER_CONSTANTS;
unsigned int adapter_idx, output_idx, adapter_count, output_count = 0; unsigned int adapter_idx, output_idx, adapter_count, output_count = 0;
struct wined3d_adapter *wined3d_adapter; struct wined3d_adapter *wined3d_adapter;
......
...@@ -686,7 +686,7 @@ BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended) ...@@ -686,7 +686,7 @@ BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended)
DWORD flags = WINED3D_PRESENT_CONVERSION | WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER DWORD flags = WINED3D_PRESENT_CONVERSION | WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER
| WINED3D_SRGB_READ_WRITE_CONTROL | WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR | WINED3D_SRGB_READ_WRITE_CONTROL | WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
| WINED3D_NO_PRIMITIVE_RESTART | WINED3D_LEGACY_CUBEMAP_FILTERING | WINED3D_NO_PRIMITIVE_RESTART | WINED3D_LEGACY_CUBEMAP_FILTERING
| WINED3D_NORMALIZED_DEPTH_BIAS; | WINED3D_NORMALIZED_DEPTH_BIAS | WINED3D_LEGACY_SHADER_CONSTANTS;
unsigned int adapter_idx, output_idx, adapter_count, output_count = 0; unsigned int adapter_idx, output_idx, adapter_count, output_count = 0;
struct wined3d_adapter *wined3d_adapter; struct wined3d_adapter *wined3d_adapter;
......
...@@ -3107,6 +3107,9 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info) ...@@ -3107,6 +3107,9 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_VERTEX] = min(gl_max, WINED3D_MAX_CBS); gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_VERTEX] = min(gl_max, WINED3D_MAX_CBS);
TRACE("Max vertex uniform blocks: %u (%d).\n", TRACE("Max vertex uniform blocks: %u (%d).\n",
gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_VERTEX], gl_max); gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_VERTEX], gl_max);
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &gl_max);
gl_info->limits.glsl_max_uniform_block_size = gl_max;
TRACE("Max uniform block size %u.\n", gl_max);
} }
} }
if (gl_info->supported[ARB_TESSELLATION_SHADER]) if (gl_info->supported[ARB_TESSELLATION_SHADER])
......
...@@ -765,6 +765,8 @@ static BOOL shader_record_register_usage(struct wined3d_shader *shader, struct w ...@@ -765,6 +765,8 @@ static BOOL shader_record_register_usage(struct wined3d_shader *shader, struct w
} }
else else
{ {
if (reg->idx[0].offset >= reg_maps->constant_float_count)
reg_maps->constant_float_count = reg->idx[0].offset + 1;
wined3d_insert_bits(reg_maps->constf, reg->idx[0].offset, 1, 0x1); wined3d_insert_bits(reg_maps->constf, reg->idx[0].offset, 1, 0x1);
} }
} }
......
...@@ -4583,6 +4583,11 @@ static void state_cb(struct wined3d_context *context, const struct wined3d_state ...@@ -4583,6 +4583,11 @@ static void state_cb(struct wined3d_context *context, const struct wined3d_state
struct wined3d_bo_gl *bo_gl; struct wined3d_bo_gl *bo_gl;
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id); TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
if (context->d3d_info->wined3d_creation_flags & WINED3D_LEGACY_SHADER_CONSTANTS)
{
WARN("Called in legacy shader constant mode.\n");
return;
}
if (STATE_IS_GRAPHICS_CONSTANT_BUFFER(state_id)) if (STATE_IS_GRAPHICS_CONSTANT_BUFFER(state_id))
shader_type = state_id - STATE_GRAPHICS_CONSTANT_BUFFER(0); shader_type = state_id - STATE_GRAPHICS_CONSTANT_BUFFER(0);
......
...@@ -1171,6 +1171,7 @@ struct wined3d_shader_reg_maps ...@@ -1171,6 +1171,7 @@ struct wined3d_shader_reg_maps
struct wined3d_shader_tgsm *tgsm; struct wined3d_shader_tgsm *tgsm;
SIZE_T tgsm_capacity; SIZE_T tgsm_capacity;
unsigned int tgsm_count; unsigned int tgsm_count;
UINT constant_float_count;
}; };
/* Keeps track of details for TEX_M#x# instructions which need to maintain /* Keeps track of details for TEX_M#x# instructions which need to maintain
...@@ -3312,6 +3313,7 @@ struct wined3d_gl_limits ...@@ -3312,6 +3313,7 @@ struct wined3d_gl_limits
UINT glsl_varyings; UINT glsl_varyings;
UINT glsl_vs_float_constants; UINT glsl_vs_float_constants;
UINT glsl_ps_float_constants; UINT glsl_ps_float_constants;
UINT glsl_max_uniform_block_size;
UINT arb_vs_float_constants; UINT arb_vs_float_constants;
UINT arb_vs_native_constants; UINT arb_vs_native_constants;
......
...@@ -1349,6 +1349,7 @@ enum wined3d_memory_segment_group ...@@ -1349,6 +1349,7 @@ enum wined3d_memory_segment_group
#define WINED3D_NO_PRIMITIVE_RESTART 0x00000800 #define WINED3D_NO_PRIMITIVE_RESTART 0x00000800
#define WINED3D_LEGACY_CUBEMAP_FILTERING 0x00001000 #define WINED3D_LEGACY_CUBEMAP_FILTERING 0x00001000
#define WINED3D_NORMALIZED_DEPTH_BIAS 0x00002000 #define WINED3D_NORMALIZED_DEPTH_BIAS 0x00002000
#define WINED3D_LEGACY_SHADER_CONSTANTS 0x00004000
#define WINED3D_RESZ_CODE 0x7fa05000 #define WINED3D_RESZ_CODE 0x7fa05000
......
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