Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions renderers/vulkan/tr_animation.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,6 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface )
tempVert[1] += w->boneWeight * ( DotProduct( bone->matrix[1], w->offset ) + bone->matrix[1][3] );
tempVert[2] += w->boneWeight * ( DotProduct( bone->matrix[2], w->offset ) + bone->matrix[2][3] );

#ifdef USE_TESS_NEEDS_NORMAL
if ( tess.needsNormal )
#endif
{
tempNormal[0] += w->boneWeight * DotProduct( bone->matrix[0], v->normal );
tempNormal[1] += w->boneWeight * DotProduct( bone->matrix[1], v->normal );
Expand All @@ -425,9 +422,6 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface )
tess.xyz[baseVertex + j][1] = tempVert[1];
tess.xyz[baseVertex + j][2] = tempVert[2];

#ifdef USE_TESS_NEEDS_NORMAL
if ( tess.needsNormal )
#endif
{
tess.normal[baseVertex + j][0] = tempNormal[0];
tess.normal[baseVertex + j][1] = tempNormal[1];
Expand Down
28 changes: 4 additions & 24 deletions renderers/vulkan/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define TR_LOCAL_H

#define USE_VK_PBR
#ifdef USE_VK_PBR
#define VK_PBR_BRDFLUT // for inspecting codebase, does not toggle brdflut.
#define VK_CUBEMAP

#ifdef VK_CUBEMAP
#define REF_CUBEMAP_IRRADIANCE_SIZE 64
#define REF_CUBEMAP_SIZE 256
#endif
#endif
#define VK_PBR_BRDFLUT // for inspecting codebase, does not toggle brdflut.
#define VK_CUBEMAP
#define REF_CUBEMAP_IRRADIANCE_SIZE 64
#define REF_CUBEMAP_SIZE 256

#define USE_VBO // store static world geometry in VBO
#define USE_FOG_COLLAPSE // not compatible with legacy dlights
Expand All @@ -47,9 +42,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* regress both streaming and frame time; only flat/static face and triangle
* surfaces use the VBO. */

//#define USE_TESS_NEEDS_NORMAL
//#define USE_TESS_NEEDS_ST2

#define SH_COEFF_COUNT 9

#include "q_shared.h"
Expand Down Expand Up @@ -2229,10 +2221,6 @@ image_t *vk_create_pbr_albedo_srgb( const char *albedoMapName, imgFlags_t flags
//
// tr_surface.c
//
#ifdef USE_VBO_GRID
void RB_SurfaceGridEstimate( srfGridMesh_t *cv, int *numVertexes, int *numIndexes );
#endif

/*
====================================================================

Expand Down Expand Up @@ -2298,14 +2286,6 @@ typedef struct shaderCommands_s
#endif
#endif

// info extracted from current shader
#ifdef USE_TESS_NEEDS_NORMAL
int needsNormal;
#endif
#ifdef USE_TESS_NEEDS_ST2
int needsST2;
#endif

int numPasses;
shaderStage_t **xstages;

Expand Down
3 changes: 0 additions & 3 deletions renderers/vulkan/tr_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1093,9 +1093,6 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, qboolean *isMirror
RB_BeginSurface( shader, fogNum );
#ifdef USE_VBO
tess.allowVBO = qfalse;
#endif
#ifdef USE_TESS_NEEDS_NORMAL
tess.needsNormal = qtrue;
#endif
rb_surfaceTable[ *drawSurf->surface ]( drawSurf->surface );

Expand Down
10 changes: 0 additions & 10 deletions renderers/vulkan/tr_shade.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,17 +485,7 @@ void RB_BeginSurface( shader_t *shader, int fogNum ) {
tess.dlightUpdateParams = qtrue;
}

#ifdef USE_TESS_NEEDS_NORMAL
tess.needsNormal = state->needsNormal || tess.dlightPass || r_shownormals->integer ||
( backEnd.currentEntity == &tr.worldEntity &&
( ( r_shDebugView && r_shDebugView->integer ) ||
( r_shWorldLighting && r_shWorldLighting->integer && r_shLighting && r_shLighting->integer &&
!R_ClassicLightingActive() ) ) );
#endif

#ifdef USE_TESS_NEEDS_ST2
tess.needsST2 = state->needsST2;
#endif

tess.numIndexes = 0;
tess.numVertexes = 0;
Expand Down
112 changes: 1 addition & 111 deletions renderers/vulkan/tr_surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,6 @@ static void RB_SurfaceTriangles( const srfTriangles_t *srf ) {
xyz[1] = dv->xyz[1];
xyz[2] = dv->xyz[2];

#ifdef USE_TESS_NEEDS_NORMAL
if ( tess.needsNormal )
#endif
{
normal[0] = dv->normal[0];
normal[1] = dv->normal[1];
Expand All @@ -469,9 +466,6 @@ static void RB_SurfaceTriangles( const srfTriangles_t *srf ) {
texCoords0[0] = dv->st[0];
texCoords0[1] = dv->st[1];

#ifdef USE_TESS_NEEDS_ST2
if ( tess.needsST2 )
#endif
{
texCoords1[0] = dv->lightmap[0];
texCoords1[1] = dv->lightmap[1];
Expand Down Expand Up @@ -1077,9 +1071,6 @@ static void RB_SurfaceFace( const srfSurfaceFace_t *surf ) {

numPoints = surf->numPoints;

#ifdef USE_TESS_NEEDS_NORMAL
if ( tess.needsNormal )
#endif
{
if ( surf->normals ) {
// per-vertex normals for non-coplanar faces
Expand All @@ -1106,9 +1097,6 @@ static void RB_SurfaceFace( const srfSurfaceFace_t *surf ) {
#ifdef USE_VK_PBR
tess.texCoords[0][ndx][0] = v[6];
tess.texCoords[0][ndx][1] = v[7];
#ifdef USE_TESS_NEEDS_ST2
if ( tess.needsST2 )
#endif
{
tess.texCoords[1][ndx][0] = v[8];
tess.texCoords[1][ndx][1] = v[9];
Expand All @@ -1121,9 +1109,6 @@ static void RB_SurfaceFace( const srfSurfaceFace_t *surf ) {
#else
tess.texCoords[0][ndx][0] = v[3];
tess.texCoords[0][ndx][1] = v[4];
#ifdef USE_TESS_NEEDS_ST2
if ( tess.needsST2 )
#endif
{
tess.texCoords[1][ndx][0] = v[5];
tess.texCoords[1][ndx][1] = v[6];
Expand Down Expand Up @@ -1176,71 +1161,6 @@ static float LodErrorForVolume( vec3_t local, float radius ) {
return r_lodCurveError->value / d;
}

#ifdef USE_VBO_GRID
void RB_SurfaceGridEstimate( srfGridMesh_t *cv, int *numVertexes, int *numIndexes )
{
int lodWidth, lodHeight;
float lodError;
int i, used, rows;
int nVertexes = 0;
int nIndexes = 0;
int irows, vrows;

lodError = r_lodCurveError->value; // fixed quality for VBO

lodWidth = 1;
for ( i = 1 ; i < cv->width-1 ; i++ ) {
if ( cv->widthLodError[i] <= lodError ) {
lodWidth++;
}
}
lodWidth++;

lodHeight = 1;
for ( i = 1 ; i < cv->height-1 ; i++ ) {
if ( cv->heightLodError[i] <= lodError ) {
lodHeight++;
}
}
lodHeight++;

used = 0;
while ( used < lodHeight - 1 ) {
// see how many rows of both verts and indexes we can add without overflowing
do {
vrows = ( SHADER_MAX_VERTEXES - tess.numVertexes ) / lodWidth;
irows = ( SHADER_MAX_INDEXES - tess.numIndexes ) / ( lodWidth * 6 );

// if we don't have enough space for at least one strip, flush the buffer
if ( vrows < 2 || irows < 1 ) {
nVertexes += tess.numVertexes;
nIndexes += tess.numIndexes;
tess.numIndexes = 0;
tess.numVertexes = 0;
} else {
break;
}
} while ( 1 );

rows = irows;
if ( vrows < irows + 1 ) {
rows = vrows - 1;
}
if ( used + rows > lodHeight ) {
rows = lodHeight - used;
}

tess.numIndexes += (rows-1)*(lodWidth-1)*6;
tess.numVertexes += rows * lodWidth;
used += rows - 1;
}

*numVertexes = nVertexes + tess.numVertexes;
*numIndexes = nIndexes + tess.numIndexes;
tess.numVertexes = 0;
tess.numIndexes = 0;
}
#endif // USE_VBO_GRID

/*
=============
Expand Down Expand Up @@ -1271,31 +1191,14 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
int dlightBits;
int *vDlightBits;

#ifdef USE_VBO_GRID
if ( tess.allowVBO && cv->vboItemIndex && !cv->dlightBits &&
RB_QueueSurfaceVBO( cv->vboItemIndex, SF_GRID ) ) {
return;
}

VBO_Flush();
#else
#ifdef USE_VBO
VBO_Flush();
#endif
#endif

dlightBits = cv->dlightBits;
tess.dlightBits |= dlightBits;

#ifdef USE_VBO_GRID
tess.surfType = SF_GRID;

// determine the allowable discrepance
if ( cv->vboItemIndex && ( tr.mapLoading || ( tess.dlightPass && tess.shader->isStaticShader ) ) )
lodError = r_lodCurveError->value; // fixed quality for VBO
else
#endif // USE_VBO_GRID
lodError = LodErrorForVolume( cv->lodOrigin, cv->lodRadius );
lodError = LodErrorForVolume( cv->lodOrigin, cv->lodRadius );

// determine which rows and columns of the subdivision
// we are actually going to use
Expand Down Expand Up @@ -1335,13 +1238,6 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
if ( vrows < 2 || irows < 1 ) {
if ( tr.mapLoading ) {
// estimate and flush
#ifdef USE_VBO_GRID
if ( cv->vboItemIndex ) {
VBO_PushData( cv->vboItemIndex, &tess );
tess.numIndexes = 0;
tess.numVertexes = 0;
} else
#endif // USE_VBO_GRID
ri.Error( ERR_DROP, "Unexpected grid flush during map loading!\n" );
} else {
RB_EndSurface();
Expand Down Expand Up @@ -1382,17 +1278,11 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
xyz[2] = dv->xyz[2];
texCoords0[0] = dv->st[0];
texCoords0[1] = dv->st[1];
#ifdef USE_TESS_NEEDS_ST2
if ( tess.needsST2 )
#endif
{
texCoords1[0] = dv->lightmap[0];
texCoords1[1] = dv->lightmap[1];
texCoords1 += 2;
}
#ifdef USE_TESS_NEEDS_NORMAL
if ( tess.needsNormal )
#endif
{
normal[0] = dv->normal[0];
normal[1] = dv->normal[1];
Expand Down
4 changes: 0 additions & 4 deletions renderers/vulkan/vk_instance.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,6 @@ static qboolean vk_create_device( VkPhysicalDevice physical_device, int device_i
else
vk.dedicatedAllocation = dedicatedAllocation;

#ifndef USE_DEDICATED_ALLOCATION
vk.dedicatedAllocation = qfalse;
#endif

device_extension_list[ device_extension_count++ ] = VK_KHR_SWAPCHAIN_EXTENSION_NAME;

if ( vk.dedicatedAllocation ) {
Expand Down
5 changes: 0 additions & 5 deletions renderers/vulkan/vk_object_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ TAA descriptors and ping-pong commit. See vk_object_id.h for the rationale.
#include "vk_image_layout.h"
#include "vk_util.h"
#include "vk_upscale.h"
#ifdef USE_VK_PBR
#include "vk_forward_plus.h"
#endif

Expand Down Expand Up @@ -122,7 +121,6 @@ void vk_object_id_begin_frame( void )

void vk_object_id_update_storage_descriptor( void )
{
#ifdef USE_VK_PBR
VkDescriptorImageInfo info;
VkWriteDescriptorSet write;
VkImageView view;
Expand Down Expand Up @@ -170,9 +168,6 @@ void vk_object_id_update_storage_descriptor( void )
write.dstSet = sets[i];
qvkUpdateDescriptorSets( vk.device, 1, &write, 0, NULL );
}
#else
(void)0;
#endif
}

void vk_barrier_object_id_for_sampling( const char *reason )
Expand Down
6 changes: 0 additions & 6 deletions renderers/vulkan/vk_reactive_mask.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ Temporal reactive mask buffer: clear, stamp (OIT reveal), barriers, pipelines.
#include "vk_post_fog.h"
#include "vk_scene_pass.h"
#include "vk_pass_registry.h"
#ifdef USE_VK_PBR
#include "vk_forward_plus.h"
#endif

#include "vk_raster_ultra.h"

Expand Down Expand Up @@ -450,7 +448,6 @@ void vk_reactive_mask_update_taa_descriptors( void )

void vk_reactive_mask_update_storage_descriptor( void )
{
#ifdef USE_VK_PBR
VkDescriptorImageInfo info;
VkWriteDescriptorSet write;
VkImageView view;
Expand Down Expand Up @@ -497,9 +494,6 @@ void vk_reactive_mask_update_storage_descriptor( void )
write.dstSet = sets[i];
qvkUpdateDescriptorSets( vk.device, 1, &write, 0, NULL );
}
#else
(void)0;
#endif
}

void vk_destroy_reactive_mask_pipeline( void )
Expand Down
Loading
Loading