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
9 changes: 0 additions & 9 deletions renderers/vulkan/extensions/rtx/vk_rtx_world.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,7 @@ static void rtx_albedo_from_srfvert( const srfVert_t *v, float *outRgb )
static void rtx_albedo_from_face_vert( const srfSurfaceFace_t *face, unsigned vidx, float *outRgb )
{
const byte *c;
#ifdef USE_VK_PBR
c = (const byte *)&face->points[vidx][10];
#else
c = (const byte *)&face->points[vidx][7];
#endif
rtx_albedo_from_bytes( c, outRgb );
}

Expand Down Expand Up @@ -166,13 +162,8 @@ static void rtx_resolve_prim_albedo( const shader_t *shader, float u, float v,
static void rtx_face_st( const srfSurfaceFace_t *face, unsigned vidx, float *u, float *v )
{
const float *p = face->points[vidx];
#ifdef USE_VK_PBR
*u = p[6];
*v = p[7];
#else
*u = p[3];
*v = p[4];
#endif
}

static uint32_t rtx_count_face_tris( const srfSurfaceFace_t *face )
Expand Down
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
15 changes: 0 additions & 15 deletions renderers/vulkan/tr_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,11 +1018,8 @@ static void ParseFace( const dsurface_t *ds, const drawVert_t *verts, msurface_t
for ( i = 0 ; i < numPoints ; i++ ) {
for ( j = 0 ; j < 3 ; j++ ) {
cv->points[i][j] = LittleFloat( verts[i].xyz[j] );
#ifdef USE_VK_PBR
cv->points[i][3+j] = LittleFloat( verts[i].normal[j] );
#endif
}
#ifdef USE_VK_PBR
for ( j = 0 ; j < 2 ; j++ ) {
cv->points[i][6+j] = LittleFloat( verts[i].st[j] );
cv->points[i][8+j] = LittleFloat( verts[i].lightmap[j] );
Expand All @@ -1033,18 +1030,6 @@ static void ParseFace( const dsurface_t *ds, const drawVert_t *verts, msurface_t
cv->points[i][8] = cv->points[i][8] * tr.lightmapScale[0] + lightmapX;
cv->points[i][9] = cv->points[i][9] * tr.lightmapScale[1] + lightmapY;
}
#else
for ( j = 0 ; j < 2 ; j++ ) {
cv->points[i][3+j] = LittleFloat( verts[i].st[j] );
cv->points[i][5+j] = LittleFloat( verts[i].lightmap[j] );
}
R_ColorShiftLightingBytes( verts[i].color.rgba, (byte *)&cv->points[i][7], qtrue );
if ( lightmapNum >= 0 && tr.mergeLightmaps ) {
// adjust lightmap coords
cv->points[i][5] = cv->points[i][5] * tr.lightmapScale[0] + lightmapX;
cv->points[i][6] = cv->points[i][6] * tr.lightmapScale[1] + lightmapY;
}
#endif
}

indexes += LittleLong( ds->firstIndex );
Expand Down
19 changes: 0 additions & 19 deletions renderers/vulkan/tr_bsp_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ static srfSurfaceFace_t *R_BspStream_AllocTopFace( const vec3_t wmins, const vec
for ( j = 0; j < 3; j++ ) {
cv->points[i][j] = corners[i][j];
}
#ifdef USE_VK_PBR
cv->points[i][3] = 0.0f;
cv->points[i][4] = 0.0f;
cv->points[i][5] = 1.0f;
Expand All @@ -285,13 +284,6 @@ static srfSurfaceFace_t *R_BspStream_AllocTopFace( const vec3_t wmins, const vec
cv->points[i][8] = 0.0f;
cv->points[i][9] = 0.0f;
cv->points[i][10] = 255.0f;
#else
cv->points[i][3] = 0.0f;
cv->points[i][4] = 0.0f;
cv->points[i][5] = 0.0f;
cv->points[i][6] = 0.0f;
cv->points[i][7] = 255.0f;
#endif
}

indexes = (int *)( (byte *)cv + cv->ofsIndices );
Expand Down Expand Up @@ -670,25 +662,14 @@ static qboolean R_BspStream_ParsePlanarFace( const dsurface_t *ds, const drawVer
for ( i = 0; i < numPoints; i++ ) {
for ( j = 0; j < 3; j++ ) {
cv->points[i][j] = LittleFloat( verts[i].xyz[j] ) + worldOrigin[j];
#ifdef USE_VK_PBR
cv->points[i][3 + j] = LittleFloat( verts[i].normal[j] );
#endif
}
#ifdef USE_VK_PBR
for ( j = 0; j < 2; j++ ) {
cv->points[i][6 + j] = LittleFloat( verts[i].st[j] );
cv->points[i][8 + j] = LittleFloat( verts[i].lightmap[j] );
}
R_BspStream_ApplyLightmapST( &cv->points[i][8], &cv->points[i][9], lightmapX, lightmapY, mergedAtlas );
R_ColorShiftLightingBytes( verts[i].color.rgba, (byte *)&cv->points[i][10], qtrue );
#else
for ( j = 0; j < 2; j++ ) {
cv->points[i][3 + j] = LittleFloat( verts[i].st[j] );
cv->points[i][5 + j] = LittleFloat( verts[i].lightmap[j] );
}
R_BspStream_ApplyLightmapST( &cv->points[i][5], &cv->points[i][6], lightmapX, lightmapY, mergedAtlas );
R_ColorShiftLightingBytes( verts[i].color.rgba, (byte *)&cv->points[i][7], qtrue );
#endif
AddPointToBounds( cv->points[i], patchMins, patchMaxs );
}

Expand Down
35 changes: 5 additions & 30 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 @@ -42,13 +37,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#define MAX_TEXTURE_SIZE 32768

#ifdef USE_VBO
#define USE_VBO_GRID /* put SF_GRID to VBO */
#endif

//#define USE_TESS_NEEDS_NORMAL
//#define USE_TESS_NEEDS_ST2

#define SH_COEFF_COUNT 9

#include "q_shared.h"
Expand Down Expand Up @@ -874,11 +862,7 @@ typedef struct srfGridMesh_s {
srfVert_t verts[1]; // variable sized
} srfGridMesh_t;

#ifdef USE_VK_PBR
#define VERTEXSIZE 11
#else
#define VERTEXSIZE 8
#endif
#define VERTEXSIZE 11
typedef struct {
surfaceType_t surfaceType;
cplane_t plane;
Expand Down Expand Up @@ -2149,9 +2133,7 @@ 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 @@ -2219,13 +2201,6 @@ typedef struct shaderCommands_s
#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 @@ -1082,9 +1082,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
8 changes: 0 additions & 8 deletions renderers/vulkan/tr_material_paint.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ static void MP_WriteFaceColor( srfSurfaceFace_t *face, int vertIndex, const byte
if ( !face || vertIndex < 0 || vertIndex >= face->numPoints ) {
return;
}
#ifdef USE_VK_PBR
dst = (byte *)&face->points[vertIndex][10];
#else
dst = (byte *)&face->points[vertIndex][7];
#endif
dst[0] = rgba[0];
dst[1] = rgba[1];
dst[2] = rgba[2];
Expand All @@ -83,11 +79,7 @@ static void MP_ReadFaceColor( const srfSurfaceFace_t *face, int vertIndex, byte
rgba[0] = rgba[1] = rgba[2] = rgba[3] = 0;
return;
}
#ifdef USE_VK_PBR
src = (const byte *)&face->points[vertIndex][10];
#else
src = (const byte *)&face->points[vertIndex][7];
#endif
rgba[0] = src[0];
rgba[1] = src[1];
rgba[2] = src[2];
Expand Down
12 changes: 0 additions & 12 deletions renderers/vulkan/tr_shade.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,18 +396,6 @@ 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;
tess.sdfUiEdge = -1.0f;
Expand Down
4 changes: 0 additions & 4 deletions renderers/vulkan/tr_shader_load.inc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ static int loadShaderBuffers( char **shaderFiles, const int numShaderFiles, char
for ( i = 0; i < numShaderFiles; i++ )
{

#ifdef USE_VK_PBR
// look for a .mtr file first
if( vk.pbrActive ){
char *ext;
Expand All @@ -35,9 +34,6 @@ static int loadShaderBuffers( char **shaderFiles, const int numShaderFiles, char
}else{
Com_sprintf(filename, sizeof(filename), "scripts/%s", shaderFiles[i]);
}
#else
Com_sprintf( filename, sizeof( filename ), "scripts/%s", shaderFiles[i] );
#endif
//ri.Printf( PRINT_DEVELOPER, "...loading '%s'\n", filename );
summand = ri.FS_ReadFile( filename, (void **)&buffers[i] );

Expand Down
Loading