Fixed crash in r_debugSurface (tr_main.c). Minor tweaks.

This commit is contained in:
Artem Kharytoniuk 2018-01-13 13:10:59 +01:00
parent f38011533d
commit 9b106ec102
5 changed files with 24 additions and 27 deletions

View File

@ -1260,9 +1260,6 @@ void dx_clear_attachments(bool clear_depth_stencil, bool clear_color, vec4_t col
} }
void dx_bind_geometry() { void dx_bind_geometry() {
if (!dx.active)
return;
// xyz stream // xyz stream
{ {
if ((dx.xyz_elements + tess.numVertexes) * sizeof(vec4_t) > XYZ_SIZE) if ((dx.xyz_elements + tess.numVertexes) * sizeof(vec4_t) > XYZ_SIZE)

View File

@ -915,14 +915,10 @@ const void *RB_DrawBuffer( const void *data ) {
qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
// VULKAN // VULKAN
if (vk.active) { // DX12
if (vk.active || dx.active) {
RB_SetGL2D(); // to ensure we have viewport that occupies entire window RB_SetGL2D(); // to ensure we have viewport that occupies entire window
vk_clear_attachments(false, true, color); vk_clear_attachments(false, true, color);
}
// DX12
if (dx.active) {
RB_SetGL2D(); // to ensure we have viewport that occupies entire window
dx_clear_attachments(false, true, color); dx_clear_attachments(false, true, color);
} }
} }
@ -1006,10 +1002,7 @@ void RB_Show_Vk_Dx_Images() {
float black[4] = {0, 0, 0, 1}; float black[4] = {0, 0, 0, 1};
if (vk.active)
vk_clear_attachments(false, true, black); vk_clear_attachments(false, true, black);
if (dx.active)
dx_clear_attachments(false, true, black); dx_clear_attachments(false, true, black);

View File

@ -1461,11 +1461,15 @@ void R_DebugPolygon( int color, int numPoints, float *points ) {
tess.numIndexes += 3; tess.numIndexes += 3;
} }
if (vk.active) {
vk_bind_geometry(); vk_bind_geometry();
vk_shade_geometry(vk.surface_debug_pipeline_solid, false, Vk_Depth_Range::normal); vk_shade_geometry(vk.surface_debug_pipeline_solid, false, Vk_Depth_Range::normal);
}
if (dx.active) {
dx_bind_geometry(); dx_bind_geometry();
dx_shade_geometry(dx.surface_debug_pipeline_solid, false, Vk_Depth_Range::normal, true, false); dx_shade_geometry(dx.surface_debug_pipeline_solid, false, Vk_Depth_Range::normal, true, false);
}
// Outline. // Outline.
Com_Memset(tess.svars.colors, tr.identityLightByte, numPoints * 2 * sizeof(color4ub_t)); Com_Memset(tess.svars.colors, tr.identityLightByte, numPoints * 2 * sizeof(color4ub_t));
@ -1477,11 +1481,15 @@ void R_DebugPolygon( int color, int numPoints, float *points ) {
tess.numVertexes = numPoints * 2; tess.numVertexes = numPoints * 2;
tess.numIndexes = 0; tess.numIndexes = 0;
if (vk.active) {
vk_bind_geometry(); vk_bind_geometry();
vk_shade_geometry(vk.surface_debug_pipeline_outline, false, Vk_Depth_Range::force_zero, false); vk_shade_geometry(vk.surface_debug_pipeline_outline, false, Vk_Depth_Range::force_zero, false);
}
if (dx.active) {
dx_bind_geometry(); dx_bind_geometry();
dx_shade_geometry(dx.surface_debug_pipeline_outline, false, Vk_Depth_Range::force_zero, false, true); dx_shade_geometry(dx.surface_debug_pipeline_outline, false, Vk_Depth_Range::force_zero, false, true);
}
tess.numVertexes = 0; tess.numVertexes = 0;
} }

View File

@ -773,9 +773,11 @@ static void ComputeTexCoords( shaderStage_t *pStage ) {
static void RB_IterateStagesGeneric( shaderCommands_t *input ) static void RB_IterateStagesGeneric( shaderCommands_t *input )
{ {
// VULKAN // VULKAN
if (vk.active)
vk_bind_geometry(); vk_bind_geometry();
// DX12 // DX12
if (dx.active)
dx_bind_geometry(); dx_bind_geometry();
for ( int stage = 0; stage < MAX_SHADER_STAGES; stage++ ) for ( int stage = 0; stage < MAX_SHADER_STAGES; stage++ )

View File

@ -2202,9 +2202,6 @@ void vk_clear_attachments(bool clear_depth_stencil, bool clear_color, vec4_t col
} }
void vk_bind_geometry() { void vk_bind_geometry() {
if (!vk.active)
return;
// xyz stream // xyz stream
{ {
if ((vk.xyz_elements + tess.numVertexes) * sizeof(vec4_t) > XYZ_SIZE) if ((vk.xyz_elements + tess.numVertexes) * sizeof(vec4_t) > XYZ_SIZE)