Commit 23380601 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Explicitly pass d3d_info and gl_info to context_stream_info_from_declaration().

parent 8bdbbf4f
...@@ -3045,12 +3045,13 @@ static BOOL fixed_get_input(BYTE usage, BYTE usage_idx, unsigned int *regnum) ...@@ -3045,12 +3045,13 @@ static BOOL fixed_get_input(BYTE usage, BYTE usage_idx, unsigned int *regnum)
} }
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
void context_stream_info_from_declaration(struct wined3d_context *context, void wined3d_stream_info_from_declaration(struct wined3d_stream_info *stream_info,
const struct wined3d_state *state, struct wined3d_stream_info *stream_info) const struct wined3d_state *state, const struct wined3d_gl_info *gl_info,
const struct wined3d_d3d_info *d3d_info)
{ {
/* We need to deal with frequency data! */ /* We need to deal with frequency data! */
struct wined3d_vertex_declaration *declaration = state->vertex_declaration; struct wined3d_vertex_declaration *declaration = state->vertex_declaration;
BOOL generic_attributes = context->d3d_info->ffp_generic_attributes; BOOL generic_attributes = d3d_info->ffp_generic_attributes;
BOOL use_vshader = use_vs(state); BOOL use_vshader = use_vs(state);
unsigned int i; unsigned int i;
...@@ -3142,7 +3143,7 @@ void context_stream_info_from_declaration(struct wined3d_context *context, ...@@ -3142,7 +3143,7 @@ void context_stream_info_from_declaration(struct wined3d_context *context,
stream_info->elements[idx].divisor = 0; stream_info->elements[idx].divisor = 0;
} }
if (!context->gl_info->supported[ARB_VERTEX_ARRAY_BGRA] if (!gl_info->supported[ARB_VERTEX_ARRAY_BGRA]
&& element->format->id == WINED3DFMT_B8G8R8A8_UNORM) && element->format->id == WINED3DFMT_B8G8R8A8_UNORM)
{ {
stream_info->swizzle_map |= 1u << idx; stream_info->swizzle_map |= 1u << idx;
...@@ -3162,7 +3163,7 @@ static void context_update_stream_info(struct wined3d_context *context, const st ...@@ -3162,7 +3163,7 @@ static void context_update_stream_info(struct wined3d_context *context, const st
unsigned int i; unsigned int i;
WORD map; WORD map;
context_stream_info_from_declaration(context, state, stream_info); wined3d_stream_info_from_declaration(stream_info, state, gl_info, d3d_info);
stream_info->all_vbo = 1; stream_info->all_vbo = 1;
context->num_buffer_queries = 0; context->num_buffer_queries = 0;
...@@ -3510,7 +3511,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, ...@@ -3510,7 +3511,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context,
context_load_unordered_access_resources(context, state->shader[WINED3D_SHADER_TYPE_PIXEL], context_load_unordered_access_resources(context, state->shader[WINED3D_SHADER_TYPE_PIXEL],
state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]); state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]);
/* TODO: Right now the dependency on the vertex shader is necessary /* TODO: Right now the dependency on the vertex shader is necessary
* since context_stream_info_from_declaration depends on the reg_maps of * since wined3d_stream_info_from_declaration() depends on the reg_maps of
* the current VS but maybe it's possible to relax the coupling in some * the current VS but maybe it's possible to relax the coupling in some
* situations at least. */ * situations at least. */
if (isStateDirty(context, STATE_VDECL) || isStateDirty(context, STATE_STREAMSRC) if (isStateDirty(context, STATE_VDECL) || isStateDirty(context, STATE_STREAMSRC)
......
...@@ -3080,7 +3080,6 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, ...@@ -3080,7 +3080,6 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
struct wined3d_state *state = &device->state; struct wined3d_state *state = &device->state;
struct wined3d_stream_info stream_info; struct wined3d_stream_info stream_info;
struct wined3d_resource *resource; struct wined3d_resource *resource;
struct wined3d_context *context;
struct wined3d_box box = {0}; struct wined3d_box box = {0};
struct wined3d_shader *vs; struct wined3d_shader *vs;
unsigned int i; unsigned int i;
...@@ -3097,9 +3096,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, ...@@ -3097,9 +3096,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
vs = state->shader[WINED3D_SHADER_TYPE_VERTEX]; vs = state->shader[WINED3D_SHADER_TYPE_VERTEX];
state->shader[WINED3D_SHADER_TYPE_VERTEX] = NULL; state->shader[WINED3D_SHADER_TYPE_VERTEX] = NULL;
context = context_acquire(device, NULL, 0); wined3d_stream_info_from_declaration(&stream_info, state, &device->adapter->gl_info, &device->adapter->d3d_info);
context_stream_info_from_declaration(context, state, &stream_info);
context_release(context);
state->shader[WINED3D_SHADER_TYPE_VERTEX] = vs; state->shader[WINED3D_SHADER_TYPE_VERTEX] = vs;
/* We can't convert FROM a VBO, and vertex buffers used to source into /* We can't convert FROM a VBO, and vertex buffers used to source into
......
...@@ -72,6 +72,49 @@ ...@@ -72,6 +72,49 @@
#define WINED3D_QUIRK_LIMITED_TEX_FILTERING 0x00000100 #define WINED3D_QUIRK_LIMITED_TEX_FILTERING 0x00000100
#define WINED3D_QUIRK_BROKEN_ARB_FOG 0x00000200 #define WINED3D_QUIRK_BROKEN_ARB_FOG 0x00000200
enum wined3d_ffp_idx
{
WINED3D_FFP_POSITION = 0,
WINED3D_FFP_BLENDWEIGHT = 1,
WINED3D_FFP_BLENDINDICES = 2,
WINED3D_FFP_NORMAL = 3,
WINED3D_FFP_PSIZE = 4,
WINED3D_FFP_DIFFUSE = 5,
WINED3D_FFP_SPECULAR = 6,
WINED3D_FFP_TEXCOORD0 = 7,
WINED3D_FFP_TEXCOORD1 = 8,
WINED3D_FFP_TEXCOORD2 = 9,
WINED3D_FFP_TEXCOORD3 = 10,
WINED3D_FFP_TEXCOORD4 = 11,
WINED3D_FFP_TEXCOORD5 = 12,
WINED3D_FFP_TEXCOORD6 = 13,
WINED3D_FFP_TEXCOORD7 = 14,
WINED3D_FFP_ATTRIBS_COUNT = 15,
};
enum wined3d_ffp_emit_idx
{
WINED3D_FFP_EMIT_FLOAT1,
WINED3D_FFP_EMIT_FLOAT2,
WINED3D_FFP_EMIT_FLOAT3,
WINED3D_FFP_EMIT_FLOAT4,
WINED3D_FFP_EMIT_D3DCOLOR,
WINED3D_FFP_EMIT_UBYTE4,
WINED3D_FFP_EMIT_SHORT2,
WINED3D_FFP_EMIT_SHORT4,
WINED3D_FFP_EMIT_UBYTE4N,
WINED3D_FFP_EMIT_SHORT2N,
WINED3D_FFP_EMIT_SHORT4N,
WINED3D_FFP_EMIT_USHORT2N,
WINED3D_FFP_EMIT_USHORT4N,
WINED3D_FFP_EMIT_UDEC3,
WINED3D_FFP_EMIT_DEC3N,
WINED3D_FFP_EMIT_FLOAT16_2,
WINED3D_FFP_EMIT_FLOAT16_4,
WINED3D_FFP_EMIT_INVALID,
WINED3D_FFP_EMIT_COUNT,
};
/* Texture format fixups */ /* Texture format fixups */
enum fixup_channel_source enum fixup_channel_source
...@@ -110,6 +153,47 @@ struct color_fixup_desc ...@@ -110,6 +153,47 @@ struct color_fixup_desc
}; };
#include <poppack.h> #include <poppack.h>
struct wined3d_d3d_limits
{
unsigned int vs_version, hs_version, ds_version, gs_version, ps_version, cs_version;
DWORD vs_uniform_count;
DWORD ps_uniform_count;
unsigned int varying_count;
unsigned int ffp_textures;
unsigned int ffp_blend_stages;
unsigned int ffp_vertex_blend_matrices;
unsigned int active_light_count;
};
typedef void (WINE_GLAPI *wined3d_ffp_attrib_func)(const void *data);
typedef void (WINE_GLAPI *wined3d_ffp_texcoord_func)(GLenum unit, const void *data);
typedef void (WINE_GLAPI *wined3d_generic_attrib_func)(GLuint idx, const void *data);
extern wined3d_ffp_attrib_func specular_func_3ubv DECLSPEC_HIDDEN;
struct wined3d_ffp_attrib_ops
{
wined3d_ffp_attrib_func position[WINED3D_FFP_EMIT_COUNT];
wined3d_ffp_attrib_func diffuse[WINED3D_FFP_EMIT_COUNT];
wined3d_ffp_attrib_func specular[WINED3D_FFP_EMIT_COUNT];
wined3d_ffp_attrib_func normal[WINED3D_FFP_EMIT_COUNT];
wined3d_ffp_texcoord_func texcoord[WINED3D_FFP_EMIT_COUNT];
wined3d_generic_attrib_func generic[WINED3D_FFP_EMIT_COUNT];
};
struct wined3d_d3d_info
{
struct wined3d_d3d_limits limits;
struct wined3d_ffp_attrib_ops ffp_attrib_ops;
BOOL xyzrhw;
BOOL emulated_flatshading;
BOOL ffp_generic_attributes;
BOOL vs_clipping;
BOOL shader_color_key;
DWORD valid_rt_mask;
DWORD wined3d_creation_flags;
BOOL shader_double_precision;
};
static const struct color_fixup_desc COLOR_FIXUP_IDENTITY = static const struct color_fixup_desc COLOR_FIXUP_IDENTITY =
{0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_Z, 0, CHANNEL_SOURCE_W}; {0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_Z, 0, CHANNEL_SOURCE_W};
...@@ -1288,49 +1372,6 @@ do { \ ...@@ -1288,49 +1372,6 @@ do { \
#define checkGLcall(A) do {} while(0) #define checkGLcall(A) do {} while(0)
#endif #endif
enum wined3d_ffp_idx
{
WINED3D_FFP_POSITION = 0,
WINED3D_FFP_BLENDWEIGHT = 1,
WINED3D_FFP_BLENDINDICES = 2,
WINED3D_FFP_NORMAL = 3,
WINED3D_FFP_PSIZE = 4,
WINED3D_FFP_DIFFUSE = 5,
WINED3D_FFP_SPECULAR = 6,
WINED3D_FFP_TEXCOORD0 = 7,
WINED3D_FFP_TEXCOORD1 = 8,
WINED3D_FFP_TEXCOORD2 = 9,
WINED3D_FFP_TEXCOORD3 = 10,
WINED3D_FFP_TEXCOORD4 = 11,
WINED3D_FFP_TEXCOORD5 = 12,
WINED3D_FFP_TEXCOORD6 = 13,
WINED3D_FFP_TEXCOORD7 = 14,
WINED3D_FFP_ATTRIBS_COUNT = 15,
};
enum wined3d_ffp_emit_idx
{
WINED3D_FFP_EMIT_FLOAT1,
WINED3D_FFP_EMIT_FLOAT2,
WINED3D_FFP_EMIT_FLOAT3,
WINED3D_FFP_EMIT_FLOAT4,
WINED3D_FFP_EMIT_D3DCOLOR,
WINED3D_FFP_EMIT_UBYTE4,
WINED3D_FFP_EMIT_SHORT2,
WINED3D_FFP_EMIT_SHORT4,
WINED3D_FFP_EMIT_UBYTE4N,
WINED3D_FFP_EMIT_SHORT2N,
WINED3D_FFP_EMIT_SHORT4N,
WINED3D_FFP_EMIT_USHORT2N,
WINED3D_FFP_EMIT_USHORT4N,
WINED3D_FFP_EMIT_UDEC3,
WINED3D_FFP_EMIT_DEC3N,
WINED3D_FFP_EMIT_FLOAT16_2,
WINED3D_FFP_EMIT_FLOAT16_4,
WINED3D_FFP_EMIT_INVALID,
WINED3D_FFP_EMIT_COUNT
};
struct wined3d_bo_address struct wined3d_bo_address
{ {
GLuint buffer_object; GLuint buffer_object;
...@@ -1366,6 +1407,10 @@ struct wined3d_stream_info ...@@ -1366,6 +1407,10 @@ struct wined3d_stream_info
WORD use_map; /* MAX_ATTRIBS, 16 */ WORD use_map; /* MAX_ATTRIBS, 16 */
}; };
void wined3d_stream_info_from_declaration(struct wined3d_stream_info *stream_info,
const struct wined3d_state *state, const struct wined3d_gl_info *gl_info,
const struct wined3d_d3d_info *d3d_info) DECLSPEC_HIDDEN;
void draw_primitive(struct wined3d_device *device, const struct wined3d_state *state, void draw_primitive(struct wined3d_device *device, const struct wined3d_state *state,
int base_vertex_idx, unsigned int start_idx, unsigned int index_count, int base_vertex_idx, unsigned int start_idx, unsigned int index_count,
unsigned int start_instance, unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN; unsigned int start_instance, unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN;
...@@ -1887,8 +1932,6 @@ void context_state_drawbuf(struct wined3d_context *context, ...@@ -1887,8 +1932,6 @@ void context_state_drawbuf(struct wined3d_context *context,
void context_state_fb(struct wined3d_context *context, void context_state_fb(struct wined3d_context *context,
const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN; const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN;
void context_surface_update(struct wined3d_context *context, const struct wined3d_surface *surface) DECLSPEC_HIDDEN; void context_surface_update(struct wined3d_context *context, const struct wined3d_surface *surface) DECLSPEC_HIDDEN;
void context_stream_info_from_declaration(struct wined3d_context *context,
const struct wined3d_state *state, struct wined3d_stream_info *stream_info) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
* Internal representation of a light * Internal representation of a light
...@@ -2287,47 +2330,6 @@ struct wined3d_driver_info ...@@ -2287,47 +2330,6 @@ struct wined3d_driver_info
DWORD version_low; DWORD version_low;
}; };
struct wined3d_d3d_limits
{
unsigned int vs_version, hs_version, ds_version, gs_version, ps_version, cs_version;
DWORD vs_uniform_count;
DWORD ps_uniform_count;
UINT varying_count;
UINT ffp_textures;
UINT ffp_blend_stages;
UINT ffp_vertex_blend_matrices;
unsigned int active_light_count;
};
typedef void (WINE_GLAPI *wined3d_ffp_attrib_func)(const void *data);
typedef void (WINE_GLAPI *wined3d_ffp_texcoord_func)(GLenum unit, const void *data);
typedef void (WINE_GLAPI *wined3d_generic_attrib_func)(GLuint idx, const void *data);
extern wined3d_ffp_attrib_func specular_func_3ubv DECLSPEC_HIDDEN;
struct wined3d_ffp_attrib_ops
{
wined3d_ffp_attrib_func position[WINED3D_FFP_EMIT_COUNT];
wined3d_ffp_attrib_func diffuse[WINED3D_FFP_EMIT_COUNT];
wined3d_ffp_attrib_func specular[WINED3D_FFP_EMIT_COUNT];
wined3d_ffp_attrib_func normal[WINED3D_FFP_EMIT_COUNT];
wined3d_ffp_texcoord_func texcoord[WINED3D_FFP_EMIT_COUNT];
wined3d_generic_attrib_func generic[WINED3D_FFP_EMIT_COUNT];
};
struct wined3d_d3d_info
{
struct wined3d_d3d_limits limits;
struct wined3d_ffp_attrib_ops ffp_attrib_ops;
BOOL xyzrhw;
BOOL emulated_flatshading;
BOOL ffp_generic_attributes;
BOOL vs_clipping;
BOOL shader_color_key;
DWORD valid_rt_mask;
DWORD wined3d_creation_flags;
BOOL shader_double_precision;
};
/* The adapter structure */ /* The adapter structure */
struct wined3d_adapter struct wined3d_adapter
{ {
......
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