wined3d: Store if half float conversion is needed in the decl.

This commit is contained in:
Stefan Dösinger 2007-12-20 01:34:22 +01:00 committed by Alexandre Julliard
parent 30c1abb1eb
commit a3c2fb9e64
4 changed files with 9 additions and 5 deletions

View File

@ -201,7 +201,7 @@ void primitiveDeclarationConvertToStridedData(
if((UINT_PTR)data < -This->stateBlock->loadBaseVertexIndex * stride) {
FIXME("System memory vertex data load offset is negative!\n");
}
} else if(vertexDeclaration->half_float_used && !GL_SUPPORT(NV_HALF_FLOAT)) {
} else if(vertexDeclaration->half_float_conv_needed) {
WARN("Half float vertex data used, but GL_NV_half_float is not supported. Not using vbos\n");
streamVBO = 0;
data = ((IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[element->Stream])->resource.allocatedMemory;
@ -1127,7 +1127,7 @@ void drawPrimitive(IWineD3DDevice *iface,
/* Instancing emulation with mixing immediate mode and arrays */
drawStridedInstanced(iface, &This->strided_streams, calculatedNumberOfindices, glPrimType,
idxData, idxSize, minIndex, StartIdx, StartVertexIndex);
} else if(GL_SUPPORT(NV_HALF_FLOAT) || (!((IWineD3DVertexDeclarationImpl *) This->stateBlock->vertexDecl)->half_float_used)) {
} else if(!((IWineD3DVertexDeclarationImpl *) This->stateBlock->vertexDecl)->half_float_conv_needed) {
drawStridedFast(iface, calculatedNumberOfindices, glPrimType,
idxData, idxSize, minIndex, StartIdx, StartVertexIndex);
} else {

View File

@ -2884,7 +2884,7 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock, WineDi
/* Default to no instancing */
stateblock->wineD3DDevice->instancedDraw = FALSE;
if(((IWineD3DVertexDeclarationImpl *)stateblock->vertexDecl)->half_float_used && !GL_SUPPORT(NV_HALF_FLOAT)) {
if(((IWineD3DVertexDeclarationImpl *)stateblock->vertexDecl)->half_float_conv_needed) {
/* This will be handled using drawStridedSlow */
return;
}

View File

@ -26,6 +26,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d_decl);
#define GLINFO_LOCATION This->wineD3DDevice->adapter->gl_info
static void dump_wined3dvertexelement(const WINED3DVERTEXELEMENT *element) {
TRACE(" Stream: %d\n", element->Stream);
TRACE(" Offset: %d\n", element->Offset);
@ -185,7 +187,9 @@ static HRESULT WINAPI IWineD3DVertexDeclarationImpl_SetDeclaration(IWineD3DVerte
This->num_swizzled_attribs++;
} else if(This->pDeclarationWine[i].Type == WINED3DDECLTYPE_FLOAT16_2 ||
This->pDeclarationWine[i].Type == WINED3DDECLTYPE_FLOAT16_4) {
This->half_float_used = TRUE;
if(!GL_SUPPORT(NV_HALF_FLOAT)) {
This->half_float_conv_needed = TRUE;
}
}
}

View File

@ -1268,7 +1268,7 @@ typedef struct IWineD3DVertexDeclarationImpl {
DWORD streams[MAX_STREAMS];
UINT num_streams;
BOOL position_transformed;
BOOL half_float_used;
BOOL half_float_conv_needed;
/* Ordered array of declaration types that need swizzling in a vshader */
attrib_declaration swizzled_attribs[MAX_ATTRIBS];