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

wined3d: Store a struct wined3d_bo_address in struct wined3d_stream_info_element.

Instead of using separate fields for the buffer object and offset.
parent 89bf30a2
...@@ -265,7 +265,7 @@ static BOOL buffer_process_converted_attribute(struct wined3d_buffer *This, ...@@ -265,7 +265,7 @@ static BOOL buffer_process_converted_attribute(struct wined3d_buffer *This,
} }
} }
data = (((DWORD_PTR)attrib->data) + offset) % This->stride; data = (((DWORD_PTR)attrib->data.addr) + offset) % This->stride;
attrib_size = attrib->format->component_count * attrib->format->component_size; attrib_size = attrib->format->component_count * attrib->format->component_size;
for (i = 0; i < attrib_size; ++i) for (i = 0; i < attrib_size; ++i)
{ {
...@@ -294,7 +294,7 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct win ...@@ -294,7 +294,7 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct win
* there, on nonexistent attribs the vbo is 0. * there, on nonexistent attribs the vbo is 0.
*/ */
if (!(si->use_map & (1 << attrib_idx)) if (!(si->use_map & (1 << attrib_idx))
|| attrib->buffer_object != This->buffer_object) || attrib->data.buffer_object != This->buffer_object)
return FALSE; return FALSE;
format = attrib->format->id; format = attrib->format->id;
......
...@@ -293,10 +293,9 @@ void device_stream_info_from_declaration(struct wined3d_device *device, ...@@ -293,10 +293,9 @@ void device_stream_info_from_declaration(struct wined3d_device *device,
element->offset, stride, debug_d3dformat(element->format->id), data.buffer_object); element->offset, stride, debug_d3dformat(element->format->id), data.buffer_object);
stream_info->elements[idx].format = element->format; stream_info->elements[idx].format = element->format;
stream_info->elements[idx].data = data;
stream_info->elements[idx].stride = stride; stream_info->elements[idx].stride = stride;
stream_info->elements[idx].data = data.addr;
stream_info->elements[idx].stream_idx = element->input_slot; stream_info->elements[idx].stream_idx = element->input_slot;
stream_info->elements[idx].buffer_object = data.buffer_object;
if (!device->adapter->gl_info.supported[ARB_VERTEX_ARRAY_BGRA] if (!device->adapter->gl_info.supported[ARB_VERTEX_ARRAY_BGRA]
&& element->format->id == WINED3DFMT_B8G8R8A8_UNORM) && element->format->id == WINED3DFMT_B8G8R8A8_UNORM)
...@@ -324,11 +323,12 @@ void device_stream_info_from_declaration(struct wined3d_device *device, ...@@ -324,11 +323,12 @@ void device_stream_info_from_declaration(struct wined3d_device *device,
buffer = device->stateBlock->state.streams[element->stream_idx].buffer; buffer = device->stateBlock->state.streams[element->stream_idx].buffer;
wined3d_buffer_preload(buffer); wined3d_buffer_preload(buffer);
/* If PreLoad dropped the buffer object, update the stream info. */ /* If the preload dropped the buffer object, update the stream info. */
if (buffer->buffer_object != element->buffer_object) if (buffer->buffer_object != element->data.buffer_object)
{ {
element->buffer_object = 0; element->data.buffer_object = 0;
element->data = buffer_get_sysmem(buffer, &device->adapter->gl_info) + (ptrdiff_t)element->data; element->data.addr = buffer_get_sysmem(buffer, &device->adapter->gl_info)
+ (ptrdiff_t)element->data.addr;
} }
if (buffer->query) if (buffer->query)
...@@ -340,11 +340,11 @@ void device_stream_info_from_declaration(struct wined3d_device *device, ...@@ -340,11 +340,11 @@ void device_stream_info_from_declaration(struct wined3d_device *device,
static void stream_info_element_from_strided(const struct wined3d_gl_info *gl_info, static void stream_info_element_from_strided(const struct wined3d_gl_info *gl_info,
const struct WineDirect3DStridedData *strided, struct wined3d_stream_info_element *e) const struct WineDirect3DStridedData *strided, struct wined3d_stream_info_element *e)
{ {
e->data.addr = strided->lpData;
e->data.buffer_object = 0;
e->format = wined3d_get_format(gl_info, strided->format); e->format = wined3d_get_format(gl_info, strided->format);
e->stride = strided->dwStride; e->stride = strided->dwStride;
e->data = strided->lpData;
e->stream_idx = 0; e->stream_idx = 0;
e->buffer_object = 0;
} }
static void device_stream_info_from_strided(const struct wined3d_gl_info *gl_info, static void device_stream_info_from_strided(const struct wined3d_gl_info *gl_info,
...@@ -3287,7 +3287,7 @@ static HRESULT process_vertices_strided(struct wined3d_device *device, DWORD dwD ...@@ -3287,7 +3287,7 @@ static HRESULT process_vertices_strided(struct wined3d_device *device, DWORD dwD
((DestFVF & WINED3DFVF_POSITION_MASK) == WINED3DFVF_XYZRHW ) ) { ((DestFVF & WINED3DFVF_POSITION_MASK) == WINED3DFVF_XYZRHW ) ) {
/* The position first */ /* The position first */
const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_POSITION]; const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_POSITION];
const float *p = (const float *)(element->data + i * element->stride); const float *p = (const float *)(element->data.addr + i * element->stride);
float x, y, z, rhw; float x, y, z, rhw;
TRACE("In: ( %06.2f %06.2f %06.2f )\n", p[0], p[1], p[2]); TRACE("In: ( %06.2f %06.2f %06.2f )\n", p[0], p[1], p[2]);
...@@ -3401,9 +3401,10 @@ static HRESULT process_vertices_strided(struct wined3d_device *device, DWORD dwD ...@@ -3401,9 +3401,10 @@ static HRESULT process_vertices_strided(struct wined3d_device *device, DWORD dwD
dest_ptr += sizeof(DWORD); dest_ptr += sizeof(DWORD);
if(dest_conv) dest_conv += sizeof(DWORD); if(dest_conv) dest_conv += sizeof(DWORD);
} }
if (DestFVF & WINED3DFVF_NORMAL) { if (DestFVF & WINED3DFVF_NORMAL)
{
const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_NORMAL]; const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_NORMAL];
const float *normal = (const float *)(element->data + i * element->stride); const float *normal = (const float *)(element->data.addr + i * element->stride);
/* AFAIK this should go into the lighting information */ /* AFAIK this should go into the lighting information */
FIXME("Didn't expect the destination to have a normal\n"); FIXME("Didn't expect the destination to have a normal\n");
copy_and_next(dest_ptr, normal, 3 * sizeof(float)); copy_and_next(dest_ptr, normal, 3 * sizeof(float));
...@@ -3412,9 +3413,10 @@ static HRESULT process_vertices_strided(struct wined3d_device *device, DWORD dwD ...@@ -3412,9 +3413,10 @@ static HRESULT process_vertices_strided(struct wined3d_device *device, DWORD dwD
} }
} }
if (DestFVF & WINED3DFVF_DIFFUSE) { if (DestFVF & WINED3DFVF_DIFFUSE)
{
const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_DIFFUSE]; const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_DIFFUSE];
const DWORD *color_d = (const DWORD *)(element->data + i * element->stride); const DWORD *color_d = (const DWORD *)(element->data.addr + i * element->stride);
if (!(stream_info->use_map & (1 << WINED3D_FFP_DIFFUSE))) if (!(stream_info->use_map & (1 << WINED3D_FFP_DIFFUSE)))
{ {
static BOOL warned = FALSE; static BOOL warned = FALSE;
...@@ -3447,7 +3449,7 @@ static HRESULT process_vertices_strided(struct wined3d_device *device, DWORD dwD ...@@ -3447,7 +3449,7 @@ static HRESULT process_vertices_strided(struct wined3d_device *device, DWORD dwD
{ {
/* What's the color value in the feedback buffer? */ /* What's the color value in the feedback buffer? */
const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_SPECULAR]; const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_SPECULAR];
const DWORD *color_s = (const DWORD *)(element->data + i * element->stride); const DWORD *color_s = (const DWORD *)(element->data.addr + i * element->stride);
if (!(stream_info->use_map & (1 << WINED3D_FFP_SPECULAR))) if (!(stream_info->use_map & (1 << WINED3D_FFP_SPECULAR)))
{ {
static BOOL warned = FALSE; static BOOL warned = FALSE;
...@@ -3476,9 +3478,10 @@ static HRESULT process_vertices_strided(struct wined3d_device *device, DWORD dwD ...@@ -3476,9 +3478,10 @@ static HRESULT process_vertices_strided(struct wined3d_device *device, DWORD dwD
} }
} }
for (tex_index = 0; tex_index < numTextures; tex_index++) { for (tex_index = 0; tex_index < numTextures; ++tex_index)
{
const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_TEXCOORD0 + tex_index]; const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_TEXCOORD0 + tex_index];
const float *tex_coord = (const float *)(element->data + i * element->stride); const float *tex_coord = (const float *)(element->data.addr + i * element->stride);
if (!(stream_info->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + tex_index)))) if (!(stream_info->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + tex_index))))
{ {
ERR("No source texture, but destination requests one\n"); ERR("No source texture, but destination requests one\n");
...@@ -3559,18 +3562,18 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, ...@@ -3559,18 +3562,18 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
if (!(stream_info.use_map & (1 << i))) continue; if (!(stream_info.use_map & (1 << i))) continue;
e = &stream_info.elements[i]; e = &stream_info.elements[i];
if (e->buffer_object) if (e->data.buffer_object)
{ {
struct wined3d_buffer *vb = device->stateBlock->state.streams[e->stream_idx].buffer; struct wined3d_buffer *vb = device->stateBlock->state.streams[e->stream_idx].buffer;
e->buffer_object = 0; e->data.buffer_object = 0;
e->data = (BYTE *)((ULONG_PTR)e->data + (ULONG_PTR)buffer_get_sysmem(vb, gl_info)); e->data.addr = (BYTE *)((ULONG_PTR)e->data.addr + (ULONG_PTR)buffer_get_sysmem(vb, gl_info));
ENTER_GL(); ENTER_GL();
GL_EXTCALL(glDeleteBuffersARB(1, &vb->buffer_object)); GL_EXTCALL(glDeleteBuffersARB(1, &vb->buffer_object));
vb->buffer_object = 0; vb->buffer_object = 0;
LEAVE_GL(); LEAVE_GL();
} }
if (e->data) if (e->data.addr)
e->data += e->stride * src_start_idx; e->data.addr += e->stride * src_start_idx;
} }
} }
......
...@@ -111,13 +111,13 @@ static void drawStridedSlow(struct wined3d_device *device, const struct wined3d_ ...@@ -111,13 +111,13 @@ static void drawStridedSlow(struct wined3d_device *device, const struct wined3d_
if (si->use_map & (1 << WINED3D_FFP_POSITION)) if (si->use_map & (1 << WINED3D_FFP_POSITION))
{ {
element = &si->elements[WINED3D_FFP_POSITION]; element = &si->elements[WINED3D_FFP_POSITION];
position = element->data + streams[element->stream_idx].offset; position = element->data.addr + streams[element->stream_idx].offset;
} }
if (si->use_map & (1 << WINED3D_FFP_NORMAL)) if (si->use_map & (1 << WINED3D_FFP_NORMAL))
{ {
element = &si->elements[WINED3D_FFP_NORMAL]; element = &si->elements[WINED3D_FFP_NORMAL];
normal = element->data + streams[element->stream_idx].offset; normal = element->data.addr + streams[element->stream_idx].offset;
} }
else else
{ {
...@@ -128,7 +128,7 @@ static void drawStridedSlow(struct wined3d_device *device, const struct wined3d_ ...@@ -128,7 +128,7 @@ static void drawStridedSlow(struct wined3d_device *device, const struct wined3d_
if (si->use_map & (1 << WINED3D_FFP_DIFFUSE)) if (si->use_map & (1 << WINED3D_FFP_DIFFUSE))
{ {
element = &si->elements[WINED3D_FFP_DIFFUSE]; element = &si->elements[WINED3D_FFP_DIFFUSE];
diffuse = element->data + streams[element->stream_idx].offset; diffuse = element->data.addr + streams[element->stream_idx].offset;
if (num_untracked_materials && element->format->id != WINED3DFMT_B8G8R8A8_UNORM) if (num_untracked_materials && element->format->id != WINED3DFMT_B8G8R8A8_UNORM)
FIXME("Implement diffuse color tracking from %s\n", debug_d3dformat(element->format->id)); FIXME("Implement diffuse color tracking from %s\n", debug_d3dformat(element->format->id));
...@@ -141,7 +141,7 @@ static void drawStridedSlow(struct wined3d_device *device, const struct wined3d_ ...@@ -141,7 +141,7 @@ static void drawStridedSlow(struct wined3d_device *device, const struct wined3d_
if (si->use_map & (1 << WINED3D_FFP_SPECULAR)) if (si->use_map & (1 << WINED3D_FFP_SPECULAR))
{ {
element = &si->elements[WINED3D_FFP_SPECULAR]; element = &si->elements[WINED3D_FFP_SPECULAR];
specular = element->data + streams[element->stream_idx].offset; specular = element->data.addr + streams[element->stream_idx].offset;
/* special case where the fog density is stored in the specular alpha channel */ /* special case where the fog density is stored in the specular alpha channel */
if (state->render_states[WINED3DRS_FOGENABLE] if (state->render_states[WINED3DRS_FOGENABLE]
...@@ -201,7 +201,7 @@ static void drawStridedSlow(struct wined3d_device *device, const struct wined3d_ ...@@ -201,7 +201,7 @@ static void drawStridedSlow(struct wined3d_device *device, const struct wined3d_
if (si->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx))) if (si->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx)))
{ {
element = &si->elements[WINED3D_FFP_TEXCOORD0 + coordIdx]; element = &si->elements[WINED3D_FFP_TEXCOORD0 + coordIdx];
texCoords[coordIdx] = element->data + streams[element->stream_idx].offset; texCoords[coordIdx] = element->data.addr + streams[element->stream_idx].offset;
tex_mask |= (1 << textureNo); tex_mask |= (1 << textureNo);
} }
else else
...@@ -465,7 +465,7 @@ static void drawStridedSlowVs(const struct wined3d_gl_info *gl_info, const struc ...@@ -465,7 +465,7 @@ static void drawStridedSlowVs(const struct wined3d_gl_info *gl_info, const struc
{ {
if (!(si->use_map & (1 << i))) continue; if (!(si->use_map & (1 << i))) continue;
ptr = si->elements[i].data + si->elements[i].stride * SkipnStrides ptr = si->elements[i].data.addr + si->elements[i].stride * SkipnStrides
+ state->streams[si->elements[i].stream_idx].offset; + state->streams[si->elements[i].stream_idx].offset;
send_attribute(gl_info, si->elements[i].format->id, i, ptr); send_attribute(gl_info, si->elements[i].format->id, i, ptr);
...@@ -529,10 +529,10 @@ static void drawStridedInstanced(const struct wined3d_gl_info *gl_info, const st ...@@ -529,10 +529,10 @@ static void drawStridedInstanced(const struct wined3d_gl_info *gl_info, const st
for(i = 0; i < numInstances; i++) { for(i = 0; i < numInstances; i++) {
/* Specify the instanced attributes using immediate mode calls */ /* Specify the instanced attributes using immediate mode calls */
for(j = 0; j < numInstancedAttribs; j++) { for(j = 0; j < numInstancedAttribs; j++) {
const BYTE *ptr = si->elements[instancedData[j]].data const BYTE *ptr = si->elements[instancedData[j]].data.addr
+ si->elements[instancedData[j]].stride * i + si->elements[instancedData[j]].stride * i
+ state->streams[si->elements[instancedData[j]].stream_idx].offset; + state->streams[si->elements[instancedData[j]].stream_idx].offset;
if (si->elements[instancedData[j]].buffer_object) if (si->elements[instancedData[j]].data.buffer_object)
{ {
struct wined3d_buffer *vb = state->streams[si->elements[instancedData[j]].stream_idx].buffer; struct wined3d_buffer *vb = state->streams[si->elements[instancedData[j]].stream_idx].buffer;
ptr += (ULONG_PTR)buffer_get_sysmem(vb, gl_info); ptr += (ULONG_PTR)buffer_get_sysmem(vb, gl_info);
...@@ -568,11 +568,11 @@ static void remove_vbos(const struct wined3d_gl_info *gl_info, ...@@ -568,11 +568,11 @@ static void remove_vbos(const struct wined3d_gl_info *gl_info,
if (!(s->use_map & (1 << i))) continue; if (!(s->use_map & (1 << i))) continue;
e = &s->elements[i]; e = &s->elements[i];
if (e->buffer_object) if (e->data.buffer_object)
{ {
struct wined3d_buffer *vb = state->streams[e->stream_idx].buffer; struct wined3d_buffer *vb = state->streams[e->stream_idx].buffer;
e->buffer_object = 0; e->data.buffer_object = 0;
e->data = (BYTE *)((ULONG_PTR)e->data + (ULONG_PTR)buffer_get_sysmem(vb, gl_info)); e->data.addr = (BYTE *)((ULONG_PTR)e->data.addr + (ULONG_PTR)buffer_get_sysmem(vb, gl_info));
} }
} }
} }
...@@ -814,13 +814,13 @@ HRESULT tesselate_rectpatch(struct wined3d_device *This, struct WineD3DRectPatch ...@@ -814,13 +814,13 @@ HRESULT tesselate_rectpatch(struct wined3d_device *This, struct WineD3DRectPatch
device_stream_info_from_declaration(This, FALSE, &stream_info, NULL); device_stream_info_from_declaration(This, FALSE, &stream_info, NULL);
e = &stream_info.elements[WINED3D_FFP_POSITION]; e = &stream_info.elements[WINED3D_FFP_POSITION];
if (e->buffer_object) if (e->data.buffer_object)
{ {
struct wined3d_buffer *vb = This->stateBlock->state.streams[e->stream_idx].buffer; struct wined3d_buffer *vb = This->stateBlock->state.streams[e->stream_idx].buffer;
e->data = (BYTE *)((ULONG_PTR)e->data + (ULONG_PTR)buffer_get_sysmem(vb, context->gl_info)); e->data.addr = (BYTE *)((ULONG_PTR)e->data.addr + (ULONG_PTR)buffer_get_sysmem(vb, context->gl_info));
} }
vtxStride = e->stride; vtxStride = e->stride;
data = e->data + data = e->data.addr +
vtxStride * info->Stride * info->StartVertexOffsetHeight + vtxStride * info->Stride * info->StartVertexOffsetHeight +
vtxStride * info->StartVertexOffsetWidth; vtxStride * info->StartVertexOffsetWidth;
......
...@@ -3294,14 +3294,14 @@ static void loadTexCoords(const struct wined3d_gl_info *gl_info, struct wined3d_ ...@@ -3294,14 +3294,14 @@ static void loadTexCoords(const struct wined3d_gl_info *gl_info, struct wined3d_
const struct wined3d_stream_info_element *e = &si->elements[WINED3D_FFP_TEXCOORD0 + coordIdx]; const struct wined3d_stream_info_element *e = &si->elements[WINED3D_FFP_TEXCOORD0 + coordIdx];
const struct wined3d_stream_state *stream = &stateblock->state.streams[e->stream_idx]; const struct wined3d_stream_state *stream = &stateblock->state.streams[e->stream_idx];
TRACE("Setting up texture %u, idx %d, cordindx %u, data %p\n", TRACE("Setting up texture %u, idx %d, coordindx %u, data {%#x:%p}.\n",
textureNo, mapped_stage, coordIdx, e->data); textureNo, mapped_stage, coordIdx, e->data.buffer_object, e->data.addr);
if (*curVBO != e->buffer_object) if (*curVBO != e->data.buffer_object)
{ {
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object)); GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->data.buffer_object));
checkGLcall("glBindBufferARB"); checkGLcall("glBindBufferARB");
*curVBO = e->buffer_object; *curVBO = e->data.buffer_object;
} }
GL_EXTCALL(glClientActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); GL_EXTCALL(glClientActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
...@@ -3309,9 +3309,11 @@ static void loadTexCoords(const struct wined3d_gl_info *gl_info, struct wined3d_ ...@@ -3309,9 +3309,11 @@ static void loadTexCoords(const struct wined3d_gl_info *gl_info, struct wined3d_
/* The coords to supply depend completely on the fvf / vertex shader */ /* The coords to supply depend completely on the fvf / vertex shader */
glTexCoordPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride, glTexCoordPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset);
glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY);
} else { }
else
{
GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + mapped_stage, 0, 0, 0, 1)); GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + mapped_stage, 0, 0, 0, 1));
} }
} }
...@@ -4094,15 +4096,15 @@ static void loadNumberedArrays(struct wined3d_stateblock *stateblock, ...@@ -4094,15 +4096,15 @@ static void loadNumberedArrays(struct wined3d_stateblock *stateblock,
continue; continue;
} }
TRACE_(d3d_shader)("Loading array %u [VBO=%u]\n", i, stream_info->elements[i].buffer_object); TRACE_(d3d_shader)("Loading array %u [VBO=%u]\n", i, stream_info->elements[i].data.buffer_object);
if (stream_info->elements[i].stride) if (stream_info->elements[i].stride)
{ {
if (curVBO != stream_info->elements[i].buffer_object) if (curVBO != stream_info->elements[i].data.buffer_object)
{ {
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, stream_info->elements[i].buffer_object)); GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, stream_info->elements[i].data.buffer_object));
checkGLcall("glBindBufferARB"); checkGLcall("glBindBufferARB");
curVBO = stream_info->elements[i].buffer_object; curVBO = stream_info->elements[i].data.buffer_object;
} }
/* Use the VBO to find out if a vertex buffer exists, not the vb /* Use the VBO to find out if a vertex buffer exists, not the vb
* pointer. vb can point to a user pointer data blob. In that case * pointer. vb can point to a user pointer data blob. In that case
...@@ -4112,7 +4114,7 @@ static void loadNumberedArrays(struct wined3d_stateblock *stateblock, ...@@ -4112,7 +4114,7 @@ static void loadNumberedArrays(struct wined3d_stateblock *stateblock,
GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format->gl_vtx_format, GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format->gl_vtx_format,
stream_info->elements[i].format->gl_vtx_type, stream_info->elements[i].format->gl_vtx_type,
stream_info->elements[i].format->gl_normalized, stream_info->elements[i].format->gl_normalized,
stream_info->elements[i].stride, stream_info->elements[i].data stream_info->elements[i].stride, stream_info->elements[i].data.addr
+ stateblock->state.load_base_vertex_index * stream_info->elements[i].stride + stateblock->state.load_base_vertex_index * stream_info->elements[i].stride
+ stream->offset)); + stream->offset));
...@@ -4128,8 +4130,8 @@ static void loadNumberedArrays(struct wined3d_stateblock *stateblock, ...@@ -4128,8 +4130,8 @@ static void loadNumberedArrays(struct wined3d_stateblock *stateblock,
* glVertexAttribPointerARB doesn't do that. Instead disable the * glVertexAttribPointerARB doesn't do that. Instead disable the
* pointer and set up the attribute statically. But we have to * pointer and set up the attribute statically. But we have to
* figure out the system memory address. */ * figure out the system memory address. */
const BYTE *ptr = stream_info->elements[i].data + stream->offset; const BYTE *ptr = stream_info->elements[i].data.addr + stream->offset;
if (stream_info->elements[i].buffer_object) if (stream_info->elements[i].data.buffer_object)
{ {
vb = stream->buffer; vb = stream->buffer;
ptr += (ULONG_PTR)buffer_get_sysmem(vb, gl_info); ptr += (ULONG_PTR)buffer_get_sysmem(vb, gl_info);
...@@ -4249,27 +4251,27 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d ...@@ -4249,27 +4251,27 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d
if (gl_info->supported[ARB_VERTEX_BLEND]) if (gl_info->supported[ARB_VERTEX_BLEND])
{ {
TRACE("Blend %u %p %u\n", e->format->component_count, TRACE("Blend %u %p %u\n", e->format->component_count,
e->data + stateblock->state.load_base_vertex_index * e->stride, e->stride + stream->offset); e->data.addr + stateblock->state.load_base_vertex_index * e->stride, e->stride + stream->offset);
glEnableClientState(GL_WEIGHT_ARRAY_ARB); glEnableClientState(GL_WEIGHT_ARRAY_ARB);
checkGLcall("glEnableClientState(GL_WEIGHT_ARRAY_ARB)"); checkGLcall("glEnableClientState(GL_WEIGHT_ARRAY_ARB)");
GL_EXTCALL(glVertexBlendARB(e->format->component_count + 1)); GL_EXTCALL(glVertexBlendARB(e->format->component_count + 1));
if (curVBO != e->buffer_object) if (curVBO != e->data.buffer_object)
{ {
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object)); GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->data.buffer_object));
checkGLcall("glBindBufferARB"); checkGLcall("glBindBufferARB");
curVBO = e->buffer_object; curVBO = e->data.buffer_object;
} }
TRACE("glWeightPointerARB(%#x, %#x, %#x, %p);\n", TRACE("glWeightPointerARB(%#x, %#x, %#x, %p);\n",
e->format->gl_vtx_format, e->format->gl_vtx_format,
e->format->gl_vtx_type, e->format->gl_vtx_type,
e->stride, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset);
GL_EXTCALL(glWeightPointerARB(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride, GL_EXTCALL(glWeightPointerARB(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset)); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset));
checkGLcall("glWeightPointerARB"); checkGLcall("glWeightPointerARB");
...@@ -4313,11 +4315,11 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d ...@@ -4313,11 +4315,11 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d
e = &si->elements[WINED3D_FFP_POSITION]; e = &si->elements[WINED3D_FFP_POSITION];
stream = &stateblock->state.streams[e->stream_idx]; stream = &stateblock->state.streams[e->stream_idx];
if (curVBO != e->buffer_object) if (curVBO != e->data.buffer_object)
{ {
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object)); GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->data.buffer_object));
checkGLcall("glBindBufferARB"); checkGLcall("glBindBufferARB");
curVBO = e->buffer_object; curVBO = e->data.buffer_object;
} }
/* min(WINED3D_ATR_FORMAT(position),3) to Disable RHW mode as 'w' coord /* min(WINED3D_ATR_FORMAT(position),3) to Disable RHW mode as 'w' coord
...@@ -4328,20 +4330,20 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d ...@@ -4328,20 +4330,20 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d
This only applies to user pointer sources, in VBOs the vertices are fixed up This only applies to user pointer sources, in VBOs the vertices are fixed up
*/ */
if (!e->buffer_object) if (!e->data.buffer_object)
{ {
TRACE("glVertexPointer(3, %#x, %#x, %p);\n", e->format->gl_vtx_type, e->stride, TRACE("glVertexPointer(3, %#x, %#x, %p);\n", e->format->gl_vtx_type, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset);
glVertexPointer(3 /* min(e->format->gl_vtx_format, 3) */, e->format->gl_vtx_type, e->stride, glVertexPointer(3 /* min(e->format->gl_vtx_format, 3) */, e->format->gl_vtx_type, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset);
} }
else else
{ {
TRACE("glVertexPointer(%#x, %#x, %#x, %p);\n", TRACE("glVertexPointer(%#x, %#x, %#x, %p);\n",
e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride, e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset);
glVertexPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride, glVertexPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset);
} }
checkGLcall("glVertexPointer(...)"); checkGLcall("glVertexPointer(...)");
glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);
...@@ -4354,17 +4356,17 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d ...@@ -4354,17 +4356,17 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d
e = &si->elements[WINED3D_FFP_NORMAL]; e = &si->elements[WINED3D_FFP_NORMAL];
stream = &stateblock->state.streams[e->stream_idx]; stream = &stateblock->state.streams[e->stream_idx];
if (curVBO != e->buffer_object) if (curVBO != e->data.buffer_object)
{ {
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object)); GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->data.buffer_object));
checkGLcall("glBindBufferARB"); checkGLcall("glBindBufferARB");
curVBO = e->buffer_object; curVBO = e->data.buffer_object;
} }
TRACE("glNormalPointer(%#x, %#x, %p);\n", e->format->gl_vtx_type, e->stride, TRACE("glNormalPointer(%#x, %#x, %p);\n", e->format->gl_vtx_type, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset);
glNormalPointer(e->format->gl_vtx_type, e->stride, glNormalPointer(e->format->gl_vtx_type, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset);
checkGLcall("glNormalPointer(...)"); checkGLcall("glNormalPointer(...)");
glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_NORMAL_ARRAY);
checkGLcall("glEnableClientState(GL_NORMAL_ARRAY)"); checkGLcall("glEnableClientState(GL_NORMAL_ARRAY)");
...@@ -4388,18 +4390,18 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d ...@@ -4388,18 +4390,18 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d
e = &si->elements[WINED3D_FFP_DIFFUSE]; e = &si->elements[WINED3D_FFP_DIFFUSE];
stream = &stateblock->state.streams[e->stream_idx]; stream = &stateblock->state.streams[e->stream_idx];
if (curVBO != e->buffer_object) if (curVBO != e->data.buffer_object)
{ {
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object)); GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->data.buffer_object));
checkGLcall("glBindBufferARB"); checkGLcall("glBindBufferARB");
curVBO = e->buffer_object; curVBO = e->data.buffer_object;
} }
TRACE("glColorPointer(%#x, %#x %#x, %p);\n", TRACE("glColorPointer(%#x, %#x %#x, %p);\n",
e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride, e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset);
glColorPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride, glColorPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset);
checkGLcall("glColorPointer(4, GL_UNSIGNED_BYTE, ...)"); checkGLcall("glColorPointer(4, GL_UNSIGNED_BYTE, ...)");
glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_COLOR_ARRAY);
checkGLcall("glEnableClientState(GL_COLOR_ARRAY)"); checkGLcall("glEnableClientState(GL_COLOR_ARRAY)");
...@@ -4422,11 +4424,11 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d ...@@ -4422,11 +4424,11 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d
GLenum type = e->format->gl_vtx_type; GLenum type = e->format->gl_vtx_type;
GLint format = e->format->gl_vtx_format; GLint format = e->format->gl_vtx_format;
if (curVBO != e->buffer_object) if (curVBO != e->data.buffer_object)
{ {
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object)); GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->data.buffer_object));
checkGLcall("glBindBufferARB"); checkGLcall("glBindBufferARB");
curVBO = e->buffer_object; curVBO = e->data.buffer_object;
} }
if (format != 4 || (gl_info->quirks & WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA)) if (format != 4 || (gl_info->quirks & WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA))
...@@ -4437,9 +4439,9 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d ...@@ -4437,9 +4439,9 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d
* 4 component secondary colors use it * 4 component secondary colors use it
*/ */
TRACE("glSecondaryColorPointer(%#x, %#x, %#x, %p);\n", format, type, e->stride, TRACE("glSecondaryColorPointer(%#x, %#x, %#x, %p);\n", format, type, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset);
GL_EXTCALL(glSecondaryColorPointerEXT(format, type, e->stride, GL_EXTCALL(glSecondaryColorPointerEXT(format, type, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset)); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset));
checkGLcall("glSecondaryColorPointerEXT(format, type, ...)"); checkGLcall("glSecondaryColorPointerEXT(format, type, ...)");
} }
else else
...@@ -4448,9 +4450,9 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d ...@@ -4448,9 +4450,9 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d
{ {
case GL_UNSIGNED_BYTE: case GL_UNSIGNED_BYTE:
TRACE("glSecondaryColorPointer(3, GL_UNSIGNED_BYTE, %#x, %p);\n", e->stride, TRACE("glSecondaryColorPointer(3, GL_UNSIGNED_BYTE, %#x, %p);\n", e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset);
GL_EXTCALL(glSecondaryColorPointerEXT(3, GL_UNSIGNED_BYTE, e->stride, GL_EXTCALL(glSecondaryColorPointerEXT(3, GL_UNSIGNED_BYTE, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset)); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset));
checkGLcall("glSecondaryColorPointerEXT(3, GL_UNSIGNED_BYTE, ...)"); checkGLcall("glSecondaryColorPointerEXT(3, GL_UNSIGNED_BYTE, ...)");
break; break;
...@@ -4458,9 +4460,9 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d ...@@ -4458,9 +4460,9 @@ static void loadVertexData(const struct wined3d_context *context, struct wined3d
FIXME("Add 4 component specular color pointers for type %x\n", type); FIXME("Add 4 component specular color pointers for type %x\n", type);
/* Make sure that the right color component is dropped */ /* Make sure that the right color component is dropped */
TRACE("glSecondaryColorPointer(3, %#x, %#x, %p);\n", type, e->stride, TRACE("glSecondaryColorPointer(3, %#x, %#x, %p);\n", type, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset);
GL_EXTCALL(glSecondaryColorPointerEXT(3, type, e->stride, GL_EXTCALL(glSecondaryColorPointerEXT(3, type, e->stride,
e->data + stateblock->state.load_base_vertex_index * e->stride + stream->offset)); e->data.addr + stateblock->state.load_base_vertex_index * e->stride + stream->offset));
checkGLcall("glSecondaryColorPointerEXT(3, type, ...)"); checkGLcall("glSecondaryColorPointerEXT(3, type, ...)");
} }
} }
......
...@@ -847,9 +847,9 @@ do { ...@@ -847,9 +847,9 @@ do {
/* Trace vector and strided data information */ /* Trace vector and strided data information */
#define TRACE_STRIDED(si, name) do { if (si->use_map & (1 << name)) \ #define TRACE_STRIDED(si, name) do { if (si->use_map & (1 << name)) \
TRACE( #name "=(data:%p, stride:%d, format:%#x, vbo %d, stream %u)\n", \ TRACE( #name " = (data {%#x:%p}, stride %d, format %s, stream %u)\n", \
si->elements[name].data, si->elements[name].stride, si->elements[name].format->id, \ si->elements[name].data.buffer_object, si->elements[name].data.addr, si->elements[name].stride, \
si->elements[name].buffer_object, si->elements[name].stream_idx); } while(0) debug_d3dformat(si->elements[name].format->id), si->elements[name].stream_idx); } while(0)
/* Global variables */ /* Global variables */
extern const float identity[16] DECLSPEC_HIDDEN; extern const float identity[16] DECLSPEC_HIDDEN;
...@@ -904,10 +904,9 @@ struct wined3d_bo_address ...@@ -904,10 +904,9 @@ struct wined3d_bo_address
struct wined3d_stream_info_element struct wined3d_stream_info_element
{ {
const struct wined3d_format *format; const struct wined3d_format *format;
struct wined3d_bo_address data;
GLsizei stride; GLsizei stride;
const BYTE *data;
UINT stream_idx; UINT stream_idx;
GLuint buffer_object;
}; };
struct wined3d_stream_info struct wined3d_stream_info
......
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