mirror of https://github.com/bjornbytes/lovr.git
mv stage tally -> shader tally;
This commit is contained in:
parent
1946fbb540
commit
c2dd7281cc
|
@ -170,8 +170,9 @@ StringEntry lovrStencilAction[] = {
|
||||||
|
|
||||||
StringEntry lovrTallyType[] = {
|
StringEntry lovrTallyType[] = {
|
||||||
[TALLY_TIMER] = ENTRY("timer"),
|
[TALLY_TIMER] = ENTRY("timer"),
|
||||||
|
[TALLY_SHADER] = ENTRY("shader"),
|
||||||
[TALLY_PIXEL] = ENTRY("pixel"),
|
[TALLY_PIXEL] = ENTRY("pixel"),
|
||||||
[TALLY_STAGE] = ENTRY("stage"),
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
StringEntry lovrTextureFeature[] = {
|
StringEntry lovrTextureFeature[] = {
|
||||||
|
@ -680,7 +681,7 @@ static int l_lovrGraphicsGetFeatures(lua_State* L) {
|
||||||
lua_pushboolean(L, features.wireframe), lua_setfield(L, -2, "wireframe");
|
lua_pushboolean(L, features.wireframe), lua_setfield(L, -2, "wireframe");
|
||||||
lua_pushboolean(L, features.depthClamp), lua_setfield(L, -2, "depthClamp");
|
lua_pushboolean(L, features.depthClamp), lua_setfield(L, -2, "depthClamp");
|
||||||
lua_pushboolean(L, features.indirectDrawFirstInstance), lua_setfield(L, -2, "indirectDrawFirstInstance");
|
lua_pushboolean(L, features.indirectDrawFirstInstance), lua_setfield(L, -2, "indirectDrawFirstInstance");
|
||||||
lua_pushboolean(L, features.stageTally), lua_setfield(L, -2, "stageTally");
|
lua_pushboolean(L, features.shaderTally), lua_setfield(L, -2, "shaderTally");
|
||||||
lua_pushboolean(L, features.float64), lua_setfield(L, -2, "float64");
|
lua_pushboolean(L, features.float64), lua_setfield(L, -2, "float64");
|
||||||
lua_pushboolean(L, features.int64), lua_setfield(L, -2, "int64");
|
lua_pushboolean(L, features.int64), lua_setfield(L, -2, "int64");
|
||||||
lua_pushboolean(L, features.int16), lua_setfield(L, -2, "int16");
|
lua_pushboolean(L, features.int16), lua_setfield(L, -2, "int16");
|
||||||
|
|
|
@ -35,7 +35,7 @@ static int l_lovrReadbackGetData(lua_State* L) {
|
||||||
case READBACK_TALLY: {
|
case READBACK_TALLY: {
|
||||||
int count = (int) info->tally.count;
|
int count = (int) info->tally.count;
|
||||||
|
|
||||||
if (lovrTallyGetInfo(info->tally.object)->type == TALLY_STAGE) {
|
if (lovrTallyGetInfo(info->tally.object)->type == TALLY_SHADER) {
|
||||||
count *= 4; // The number of pipeline statistics that are tracked
|
count *= 4; // The number of pipeline statistics that are tracked
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -454,8 +454,8 @@ void gpu_pipeline_destroy(gpu_pipeline* pipeline);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GPU_TALLY_TIMER,
|
GPU_TALLY_TIMER,
|
||||||
GPU_TALLY_PIXEL,
|
GPU_TALLY_SHADER,
|
||||||
GPU_TALLY_STAGE
|
GPU_TALLY_PIXEL
|
||||||
} gpu_tally_type;
|
} gpu_tally_type;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -605,7 +605,7 @@ typedef struct {
|
||||||
bool wireframe;
|
bool wireframe;
|
||||||
bool depthClamp;
|
bool depthClamp;
|
||||||
bool indirectDrawFirstInstance;
|
bool indirectDrawFirstInstance;
|
||||||
bool stageTally;
|
bool shaderTally;
|
||||||
bool float64;
|
bool float64;
|
||||||
bool int64;
|
bool int64;
|
||||||
bool int16;
|
bool int16;
|
||||||
|
|
|
@ -1372,15 +1372,15 @@ void gpu_pipeline_destroy(gpu_pipeline* pipeline) {
|
||||||
bool gpu_tally_init(gpu_tally* tally, gpu_tally_info* info) {
|
bool gpu_tally_init(gpu_tally* tally, gpu_tally_info* info) {
|
||||||
VkQueryType queryTypes[] = {
|
VkQueryType queryTypes[] = {
|
||||||
[GPU_TALLY_TIMER] = VK_QUERY_TYPE_TIMESTAMP,
|
[GPU_TALLY_TIMER] = VK_QUERY_TYPE_TIMESTAMP,
|
||||||
[GPU_TALLY_PIXEL] = VK_QUERY_TYPE_OCCLUSION,
|
[GPU_TALLY_SHADER] = VK_QUERY_TYPE_PIPELINE_STATISTICS,
|
||||||
[GPU_TALLY_STAGE] = VK_QUERY_TYPE_PIPELINE_STATISTICS
|
[GPU_TALLY_PIXEL] = VK_QUERY_TYPE_OCCLUSION
|
||||||
};
|
};
|
||||||
|
|
||||||
VkQueryPoolCreateInfo createInfo = {
|
VkQueryPoolCreateInfo createInfo = {
|
||||||
.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO,
|
||||||
.queryType = queryTypes[info->type],
|
.queryType = queryTypes[info->type],
|
||||||
.queryCount = info->count,
|
.queryCount = info->count,
|
||||||
.pipelineStatistics = info->type == GPU_TALLY_STAGE ? (
|
.pipelineStatistics = info->type == GPU_TALLY_SHADER ? (
|
||||||
VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT |
|
VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT |
|
||||||
VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT |
|
VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT |
|
||||||
VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT |
|
VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT |
|
||||||
|
@ -1878,7 +1878,7 @@ bool gpu_init(gpu_config* config) {
|
||||||
config->features->wireframe = enable->fillModeNonSolid = supports->fillModeNonSolid;
|
config->features->wireframe = enable->fillModeNonSolid = supports->fillModeNonSolid;
|
||||||
config->features->depthClamp = enable->depthClamp = supports->depthClamp;
|
config->features->depthClamp = enable->depthClamp = supports->depthClamp;
|
||||||
config->features->indirectDrawFirstInstance = enable->drawIndirectFirstInstance = supports->drawIndirectFirstInstance;
|
config->features->indirectDrawFirstInstance = enable->drawIndirectFirstInstance = supports->drawIndirectFirstInstance;
|
||||||
config->features->stageTally = enable->pipelineStatisticsQuery = supports->pipelineStatisticsQuery;
|
config->features->shaderTally = enable->pipelineStatisticsQuery = supports->pipelineStatisticsQuery;
|
||||||
config->features->float64 = enable->shaderFloat64 = supports->shaderFloat64;
|
config->features->float64 = enable->shaderFloat64 = supports->shaderFloat64;
|
||||||
config->features->int64 = enable->shaderInt64 = supports->shaderInt64;
|
config->features->int64 = enable->shaderInt64 = supports->shaderInt64;
|
||||||
config->features->int16 = enable->shaderInt16 = supports->shaderInt16;
|
config->features->int16 = enable->shaderInt16 = supports->shaderInt16;
|
||||||
|
|
|
@ -2745,7 +2745,7 @@ Readback* lovrReadbackCreate(const ReadbackInfo* info) {
|
||||||
break;
|
break;
|
||||||
case READBACK_TALLY:
|
case READBACK_TALLY:
|
||||||
lovrRetain(info->tally.object);
|
lovrRetain(info->tally.object);
|
||||||
uint32_t stride = info->tally.object->info.type == TALLY_STAGE ? 16 : 4;
|
uint32_t stride = info->tally.object->info.type == TALLY_SHADER ? 16 : 4;
|
||||||
readback->size = info->tally.count * stride;
|
readback->size = info->tally.count * stride;
|
||||||
readback->data = malloc(readback->size);
|
readback->data = malloc(readback->size);
|
||||||
lovrAssert(readback->data, "Out of memory");
|
lovrAssert(readback->data, "Out of memory");
|
||||||
|
@ -2820,7 +2820,7 @@ Tally* lovrTallyCreate(const TallyInfo* info) {
|
||||||
lovrCheck(info->count > 0, "Tally count must be greater than zero");
|
lovrCheck(info->count > 0, "Tally count must be greater than zero");
|
||||||
lovrCheck(info->count <= 4096, "Maximum Tally count is 4096");
|
lovrCheck(info->count <= 4096, "Maximum Tally count is 4096");
|
||||||
lovrCheck(info->views <= state.limits.renderSize[2], "Tally view count can not exceed the maximum view count");
|
lovrCheck(info->views <= state.limits.renderSize[2], "Tally view count can not exceed the maximum view count");
|
||||||
lovrCheck(info->type != TALLY_STAGE || state.features.stageTally, "This GPU does not support the 'stage' Tally type");
|
lovrCheck(info->type != TALLY_SHADER || state.features.shaderTally, "This GPU does not support the 'shader' Tally type");
|
||||||
Tally* tally = calloc(1, sizeof(Tally) + gpu_sizeof_tally());
|
Tally* tally = calloc(1, sizeof(Tally) + gpu_sizeof_tally());
|
||||||
lovrAssert(tally, "Out of memory");
|
lovrAssert(tally, "Out of memory");
|
||||||
tally->ref = 1;
|
tally->ref = 1;
|
||||||
|
@ -4872,7 +4872,7 @@ void lovrPassCopyTallyToBuffer(Pass* pass, Tally* tally, Buffer* buffer, uint32_
|
||||||
lovrTallyResolve(tally, srcIndex, count, buffer->gpu, dstOffset, pass->stream);
|
lovrTallyResolve(tally, srcIndex, count, buffer->gpu, dstOffset, pass->stream);
|
||||||
trackBuffer(pass, buffer, GPU_PHASE_SHADER_COMPUTE, GPU_CACHE_STORAGE_WRITE);
|
trackBuffer(pass, buffer, GPU_PHASE_SHADER_COMPUTE, GPU_CACHE_STORAGE_WRITE);
|
||||||
} else {
|
} else {
|
||||||
uint32_t stride = tally->info.type == TALLY_STAGE ? 16 : 4;
|
uint32_t stride = tally->info.type == TALLY_SHADER ? 16 : 4;
|
||||||
gpu_copy_tally_buffer(pass->stream, tally->gpu, buffer->gpu, srcIndex, dstOffset, count, stride);
|
gpu_copy_tally_buffer(pass->stream, tally->gpu, buffer->gpu, srcIndex, dstOffset, count, stride);
|
||||||
trackBuffer(pass, buffer, GPU_PHASE_TRANSFER, GPU_CACHE_TRANSFER_WRITE);
|
trackBuffer(pass, buffer, GPU_PHASE_TRANSFER, GPU_CACHE_TRANSFER_WRITE);
|
||||||
}
|
}
|
||||||
|
@ -5013,7 +5013,7 @@ Readback* lovrPassReadTally(Pass* pass, Tally* tally, uint32_t index, uint32_t c
|
||||||
if (tally->info.type == TALLY_TIMER) {
|
if (tally->info.type == TALLY_TIMER) {
|
||||||
lovrTallyResolve(tally, index, count, readback->buffer, 0, pass->stream);
|
lovrTallyResolve(tally, index, count, readback->buffer, 0, pass->stream);
|
||||||
} else {
|
} else {
|
||||||
uint32_t stride = tally->info.type == TALLY_STAGE ? 16 : 4;
|
uint32_t stride = tally->info.type == TALLY_SHADER ? 16 : 4;
|
||||||
gpu_copy_tally_buffer(pass->stream, tally->gpu, readback->buffer, index, 0, count, stride);
|
gpu_copy_tally_buffer(pass->stream, tally->gpu, readback->buffer, index, 0, count, stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ typedef struct {
|
||||||
bool wireframe;
|
bool wireframe;
|
||||||
bool depthClamp;
|
bool depthClamp;
|
||||||
bool indirectDrawFirstInstance;
|
bool indirectDrawFirstInstance;
|
||||||
bool stageTally;
|
bool shaderTally;
|
||||||
bool float64;
|
bool float64;
|
||||||
bool int64;
|
bool int64;
|
||||||
bool int16;
|
bool int16;
|
||||||
|
@ -470,8 +470,8 @@ struct Image* lovrReadbackGetImage(Readback* readback);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TALLY_TIMER,
|
TALLY_TIMER,
|
||||||
TALLY_PIXEL,
|
TALLY_SHADER,
|
||||||
TALLY_STAGE
|
TALLY_PIXEL
|
||||||
} TallyType;
|
} TallyType;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
Loading…
Reference in New Issue