No need for thread-local shader translator as all reqs come from GPU CP.
This commit is contained in:
parent
4a796627f2
commit
a446d9c64a
|
@ -1596,7 +1596,8 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateShaders(
|
||||||
xe_gpu_program_cntl_t program_cntl;
|
xe_gpu_program_cntl_t program_cntl;
|
||||||
program_cntl.dword_0 = regs.sq_program_cntl;
|
program_cntl.dword_0 = regs.sq_program_cntl;
|
||||||
if (!active_vertex_shader_->has_prepared()) {
|
if (!active_vertex_shader_->has_prepared()) {
|
||||||
if (!active_vertex_shader_->PrepareVertexShader(program_cntl)) {
|
if (!active_vertex_shader_->PrepareVertexShader(&shader_translator_,
|
||||||
|
program_cntl)) {
|
||||||
XELOGE("Unable to prepare vertex shader");
|
XELOGE("Unable to prepare vertex shader");
|
||||||
return UpdateStatus::kError;
|
return UpdateStatus::kError;
|
||||||
}
|
}
|
||||||
|
@ -1606,7 +1607,8 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateShaders(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!active_pixel_shader_->has_prepared()) {
|
if (!active_pixel_shader_->has_prepared()) {
|
||||||
if (!active_pixel_shader_->PreparePixelShader(program_cntl)) {
|
if (!active_pixel_shader_->PreparePixelShader(&shader_translator_,
|
||||||
|
program_cntl)) {
|
||||||
XELOGE("Unable to prepare pixel shader");
|
XELOGE("Unable to prepare pixel shader");
|
||||||
return UpdateStatus::kError;
|
return UpdateStatus::kError;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "xenia/gpu/gl4/draw_batcher.h"
|
#include "xenia/gpu/gl4/draw_batcher.h"
|
||||||
#include "xenia/gpu/gl4/gl_context.h"
|
#include "xenia/gpu/gl4/gl_context.h"
|
||||||
#include "xenia/gpu/gl4/gl4_shader.h"
|
#include "xenia/gpu/gl4/gl4_shader.h"
|
||||||
|
#include "xenia/gpu/gl4/gl4_shader_translator.h"
|
||||||
#include "xenia/gpu/gl4/texture_cache.h"
|
#include "xenia/gpu/gl4/texture_cache.h"
|
||||||
#include "xenia/gpu/register_file.h"
|
#include "xenia/gpu/register_file.h"
|
||||||
#include "xenia/gpu/tracing.h"
|
#include "xenia/gpu/tracing.h"
|
||||||
|
@ -259,6 +260,7 @@ class CommandProcessor {
|
||||||
|
|
||||||
bool has_bindless_vbos_;
|
bool has_bindless_vbos_;
|
||||||
|
|
||||||
|
GL4ShaderTranslator shader_translator_;
|
||||||
std::vector<std::unique_ptr<GL4Shader>> all_shaders_;
|
std::vector<std::unique_ptr<GL4Shader>> all_shaders_;
|
||||||
std::unordered_map<uint64_t, GL4Shader*> shader_cache_;
|
std::unordered_map<uint64_t, GL4Shader*> shader_cache_;
|
||||||
GL4Shader* active_vertex_shader_;
|
GL4Shader* active_vertex_shader_;
|
||||||
|
|
|
@ -23,9 +23,6 @@ using namespace xe::gpu::xenos;
|
||||||
|
|
||||||
extern "C" GLEWContext* glewGetContext();
|
extern "C" GLEWContext* glewGetContext();
|
||||||
|
|
||||||
// Stateful, but minimally.
|
|
||||||
thread_local GL4ShaderTranslator shader_translator_;
|
|
||||||
|
|
||||||
GL4Shader::GL4Shader(ShaderType shader_type, uint64_t data_hash,
|
GL4Shader::GL4Shader(ShaderType shader_type, uint64_t data_hash,
|
||||||
const uint32_t* dword_ptr, uint32_t dword_count)
|
const uint32_t* dword_ptr, uint32_t dword_count)
|
||||||
: Shader(shader_type, data_hash, dword_ptr, dword_count),
|
: Shader(shader_type, data_hash, dword_ptr, dword_count),
|
||||||
|
@ -224,6 +221,7 @@ bool GL4Shader::PrepareVertexArrayObject() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GL4Shader::PrepareVertexShader(
|
bool GL4Shader::PrepareVertexShader(
|
||||||
|
GL4ShaderTranslator* shader_translator,
|
||||||
const xenos::xe_gpu_program_cntl_t& program_cntl) {
|
const xenos::xe_gpu_program_cntl_t& program_cntl) {
|
||||||
if (has_prepared_) {
|
if (has_prepared_) {
|
||||||
return is_valid_;
|
return is_valid_;
|
||||||
|
@ -277,7 +275,7 @@ bool GL4Shader::PrepareVertexShader(
|
||||||
GetFooter();
|
GetFooter();
|
||||||
|
|
||||||
std::string translated_source =
|
std::string translated_source =
|
||||||
shader_translator_.TranslateVertexShader(this, program_cntl);
|
shader_translator->TranslateVertexShader(this, program_cntl);
|
||||||
if (translated_source.empty()) {
|
if (translated_source.empty()) {
|
||||||
XELOGE("Vertex shader failed translation");
|
XELOGE("Vertex shader failed translation");
|
||||||
return false;
|
return false;
|
||||||
|
@ -293,6 +291,7 @@ bool GL4Shader::PrepareVertexShader(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GL4Shader::PreparePixelShader(
|
bool GL4Shader::PreparePixelShader(
|
||||||
|
GL4ShaderTranslator* shader_translator,
|
||||||
const xenos::xe_gpu_program_cntl_t& program_cntl) {
|
const xenos::xe_gpu_program_cntl_t& program_cntl) {
|
||||||
if (has_prepared_) {
|
if (has_prepared_) {
|
||||||
return is_valid_;
|
return is_valid_;
|
||||||
|
@ -330,7 +329,7 @@ bool GL4Shader::PreparePixelShader(
|
||||||
GetFooter();
|
GetFooter();
|
||||||
|
|
||||||
std::string translated_source =
|
std::string translated_source =
|
||||||
shader_translator_.TranslatePixelShader(this, program_cntl);
|
shader_translator->TranslatePixelShader(this, program_cntl);
|
||||||
if (translated_source.empty()) {
|
if (translated_source.empty()) {
|
||||||
XELOGE("Pixel shader failed translation");
|
XELOGE("Pixel shader failed translation");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -19,6 +19,8 @@ namespace xe {
|
||||||
namespace gpu {
|
namespace gpu {
|
||||||
namespace gl4 {
|
namespace gl4 {
|
||||||
|
|
||||||
|
class GL4ShaderTranslator;
|
||||||
|
|
||||||
class GL4Shader : public Shader {
|
class GL4Shader : public Shader {
|
||||||
public:
|
public:
|
||||||
GL4Shader(ShaderType shader_type, uint64_t data_hash,
|
GL4Shader(ShaderType shader_type, uint64_t data_hash,
|
||||||
|
@ -28,8 +30,10 @@ class GL4Shader : public Shader {
|
||||||
GLuint program() const { return program_; }
|
GLuint program() const { return program_; }
|
||||||
GLuint vao() const { return vao_; }
|
GLuint vao() const { return vao_; }
|
||||||
|
|
||||||
bool PrepareVertexShader(const xenos::xe_gpu_program_cntl_t& program_cntl);
|
bool PrepareVertexShader(GL4ShaderTranslator* shader_translator,
|
||||||
bool PreparePixelShader(const xenos::xe_gpu_program_cntl_t& program_cntl);
|
const xenos::xe_gpu_program_cntl_t& program_cntl);
|
||||||
|
bool PreparePixelShader(GL4ShaderTranslator* shader_translator,
|
||||||
|
const xenos::xe_gpu_program_cntl_t& program_cntl);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string GetHeader();
|
std::string GetHeader();
|
||||||
|
|
Loading…
Reference in New Issue