Clean up a small inconsistency

This commit is contained in:
Henrik Rydgård 2017-12-07 21:08:34 +01:00
parent 026d3d4a00
commit fb74c9dfeb
8 changed files with 11 additions and 19 deletions

View file

@ -54,7 +54,6 @@ enum : uint64_t {
DIRTY_TEXENV = 1ULL << 4,
DIRTY_ALPHACOLORREF = 1ULL << 5,
// 1 << 6 is free! Wait, not anymore...
DIRTY_STENCILREPLACEVALUE = 1ULL << 6,
DIRTY_ALPHACOLORMASK = 1ULL << 7,

View file

@ -113,12 +113,10 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView
ConvertMatrix4x3To3x4Transposed(ub->tex, gstate.tgenMatrix);
}
// Combined two small uniforms
if (dirtyUniforms & (DIRTY_FOGCOEF | DIRTY_STENCILREPLACEVALUE)) {
float fogcoef_stencil[3] = {
if (dirtyUniforms & DIRTY_FOGCOEF) {
float fogcoef_stencil[2] = {
getFloat24(gstate.fog1),
getFloat24(gstate.fog2),
(float)gstate.getStencilTestRef()/255.0f
};
if (my_isinf(fogcoef_stencil[1])) {
// not really sure what a sensible value might be.
@ -136,7 +134,11 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView
ERROR_LOG_REPORT_ONCE(fognan, G3D, "Unhandled fog NaN/INF combo: %f %f", fogcoef_stencil[0], fogcoef_stencil[1]);
}
#endif
CopyFloat3(ub->fogCoef_stencil, fogcoef_stencil);
CopyFloat2(ub->fogCoef, fogcoef_stencil);
}
if (dirtyUniforms & DIRTY_STENCILREPLACEVALUE) {
ub->stencil = (float)gstate.getStencilTestRef() / 255.0;
}
// Note - this one is not in lighting but in transformCommon as it has uses beyond lighting

View file

@ -20,6 +20,7 @@ enum : uint64_t {
// TODO: Split into two structs, one for software transform and one for hardware transform, to save space.
// 512 bytes. Probably can't get to 256 (nVidia's UBO alignment).
// Every line here is a 4-float.
struct UB_VS_FS_Base {
float proj[16];
float proj_through[16];
@ -28,12 +29,9 @@ struct UB_VS_FS_Base {
float tex[12];
float uvScaleOffset[4];
float depthRange[4];
float fogCoef_stencil[4];
float fogCoef[2]; float stencil; float pad0;
float matAmbient[4];
int spline_count_u;
int spline_count_v;
int spline_type_u;
int spline_type_v;
int spline_count_u; int spline_count_v; int spline_type_u; int spline_type_v;
// Fragment data
float fogColor[4];
float texEnvColor[4];

View file

@ -78,8 +78,6 @@ static const D3D11CommandTableEntry commandTable[] = {
// Changes that dirty the current texture.
{ GE_CMD_TEXSIZE0, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTE, 0, &GPUCommon::Execute_TexSize0 },
{ GE_CMD_STENCILTEST, FLAG_FLUSHBEFOREONCHANGE, DIRTY_STENCILREPLACEVALUE | DIRTY_FOGCOEF | DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE }, // These are combined in D3D11
// Changing the vertex type requires us to flush.
{ GE_CMD_VERTEXTYPE, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_VertexType },

View file

@ -62,8 +62,6 @@ static const D3D9CommandTableEntry commandTable[] = {
// Changes that dirty the current texture.
{ GE_CMD_TEXSIZE0, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTE, 0, &GPUCommon::Execute_TexSize0 },
{ GE_CMD_STENCILTEST, FLAG_FLUSHBEFOREONCHANGE, DIRTY_STENCILREPLACEVALUE | DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE },
// Changing the vertex type requires us to flush.
{ GE_CMD_VERTEXTYPE, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_VertexType },

View file

@ -65,8 +65,6 @@ static const GLESCommandTableEntry commandTable[] = {
// Changes that dirty the current texture.
{ GE_CMD_TEXSIZE0, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTE, 0, &GPUCommon::Execute_TexSize0 },
{ GE_CMD_STENCILTEST, FLAG_FLUSHBEFOREONCHANGE, DIRTY_STENCILREPLACEVALUE | DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE },
// Changing the vertex type requires us to flush.
{ GE_CMD_VERTEXTYPE, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_VertexType },

View file

@ -99,6 +99,7 @@ const CommonCommandTableEntry commonCommandTable[] = {
{ GE_CMD_CULLFACEENABLE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_RASTER_STATE },
{ GE_CMD_DITHERENABLE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_RASTER_STATE },
{ GE_CMD_STENCILOP, FLAG_FLUSHBEFOREONCHANGE, DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_FRAGMENTSHADER_STATE },
{ GE_CMD_STENCILTEST, FLAG_FLUSHBEFOREONCHANGE, DIRTY_STENCILREPLACEVALUE | DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE },
{ GE_CMD_STENCILTESTENABLE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_FRAGMENTSHADER_STATE },
{ GE_CMD_ALPHABLENDENABLE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_BLEND_STATE | DIRTY_FRAGMENTSHADER_STATE },
{ GE_CMD_BLENDMODE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_BLEND_STATE | DIRTY_FRAGMENTSHADER_STATE },

View file

@ -60,8 +60,6 @@ static const VulkanCommandTableEntry commandTable[] = {
// Changes that dirty the current texture.
{ GE_CMD_TEXSIZE0, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTE, 0, &GPUCommon::Execute_TexSize0 },
{ GE_CMD_STENCILTEST, FLAG_FLUSHBEFOREONCHANGE, DIRTY_STENCILREPLACEVALUE | DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE },
// Changing the vertex type requires us to flush.
{ GE_CMD_VERTEXTYPE, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_VertexType },